Closed Shoro2 closed 1 year ago
Confirmed on 562c6a42f58365497c2d3e60266844516b3f79f9 Tried to create a 1v1 chart from npc and creashed with Assert slot < 3
This is caused by Azerothcore merging with Trinitycore, when a character is loaded, it runs the
void Player::_LoadArenaTeamInfo()
which before the merge, loops over all the existing pairs.. (which is stupid considering what they do later)
for (auto const& itr : ArenaTeam::ArenaSlotByType)
if (uint32 arenaTeamId = Player::GetArenaTeamIdFromStorage(GetGUID().GetCounter(), itr.second))
This ONLY worked before as they didnt access the arena type by value, it just hid the actual error lol.
Before:
uint32 Player::GetArenaTeamIdFromStorage(ObjectGuid::LowType guid, uint8 slot)
{
if (GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(guid))
{
auto itr = playerData->arenaTeamId.find(slot);
if (itr != playerData->arenaTeamId.end())
{
return itr->second;
}
}
return 0;
}
Now:
uint32 CharacterCache::GetCharacterArenaTeamIdByGuid(ObjectGuid guid, uint8 type) const
{
auto itr = _characterCacheStore.find(guid);
if (itr == _characterCacheStore.end())
{
return 0;
}
return itr->second.ArenaTeamId[type];
}
Here they access it by index, which is the slot type, and since they are still looping over the amount of pairs, which is originally 3, but increased by 1 to 4 by the 1v1 script:
ArenaTeam::ArenaSlotByType.insert({ ARENA_TEAM_1V1, ARENA_SLOT_1V1 });
Remember, they still loop over like this:
for (auto const& itr : ArenaTeam::ArenaSlotByType)
if (uint32 arenaTeamId = Player::GetArenaTeamIdFromStorage(GetGUID().GetCounter(), itr.second))
So now we have 4 slots, but internally, the core only stores 3 now:
struct CharacterCacheEntry
{
ObjectGuid Guid;
std::string Name;
uint32 AccountId;
uint8 Class;
uint8 Race;
uint8 Sex;
uint8 Level;
uint8 MailCount;
ObjectGuid::LowType GuildId;
std::array<uint32, MAX_ARENA_SLOT> ArenaTeamId;
ObjectGuid GroupGuid;
};
As MAX_ARENA_SLOT is 3
What is the current status of this issue, has it been resolved or does the problem persist? The module has had some updates, but I don't know if all the issues have been fixed. I look forward to hearing from you. Thank you.
Compile the module with the latest version of the emulator. I ask you to do the same, and to check if the bugs persist. If so, please reopen an issue, providing information to correct the bug. Thank you.
AzerothCore rev. 1a27f606f17d 2021-11-27 17:50:38 +0000 (master branch) (Win64, Debug, Static) im using vs2019 to compile compiling and server startup works fine, but when i enter the world with a char it crashes:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\array(554) : Assertion failed: array subscript out of range
im just using stock ac, no other modules