| 13629 | //rognar optimization |
| 13630 | //must be improved!! "if" and "switch" - it's very not aesthetically :))) |
| 13631 | //but we should know whith data is cached |
| 13632 | //PLAYER_FIELD_ARENA_TEAM_INFO* very is often using with pvp&arena patch :) |
| 13633 | if( index == PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 0 * 6 + 5 |
| 13634 | || index == PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 1 * 6 + 5 |
| 13635 | || index == PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 2 * 6 + 5 |
| 13636 | || index == PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (0 * 6) |
| 13637 | || index == PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (1 * 6) |
| 13638 | || index == PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (2 * 6) |
| 13639 | || index == UNIT_FIELD_LEVEL) |
| 13640 | { |
| 13641 | CachePlayerInfoMap::iterator _iter = objmgr.m_mPlayerInfoMap.find(GUID_LOPART(guid)); |
| 13642 | if(_iter != objmgr.m_mPlayerInfoMap.end()) |
| 13643 | { |
| 13644 | switch(index) |
| 13645 | { |
| 13646 | case (PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 0 * 6 + 5): |
| 13647 | return _iter->second->unArenaInfoSlot0; |
| 13648 | case (PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 1 * 6 + 5): |
| 13649 | return _iter->second->unArenaInfoSlot1; |
| 13650 | case (PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 2 * 6 + 5): |
| 13651 | return _iter->second->unArenaInfoSlot2; |
| 13652 | case (PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (0 * 6)): |
| 13653 | return _iter->second->unArenaInfoId0; |
| 13654 | case (PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (1 * 6)): |
| 13655 | return _iter->second->unArenaInfoId1; |
| 13656 | case (PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (2 * 6)): |
| 13657 | return _iter->second->unArenaInfoId2; |
| 13658 | case (UNIT_FIELD_LEVEL): |
| 13659 | return _iter->second->unLevel; |
| 13660 | } |
| 13661 | } |
| 13662 | } |
| 15256 | |
| 15257 | //to prevent access to DB we should cache some data, which is used very often |
| 15258 | CachePlayerInfoMap::iterator _iter = objmgr.m_mPlayerInfoMap.find(GetGUIDLow()); |
| 15259 | if(_iter != objmgr.m_mPlayerInfoMap.end())//skip new players |
| 15260 | { |
| 15261 | _iter->second->unLevel = getLevel(); |
| 15262 | |
| 15263 | _iter->second->unArenaInfoSlot0 = GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 0 * 6 + 5); |
| 15264 | _iter->second->unArenaInfoSlot1 = GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 1 * 6 + 5); |
| 15265 | _iter->second->unArenaInfoSlot2 = GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 2 * 6 + 5); |
| 15266 | |
| 15267 | _iter->second->unfield = GetUInt32Value(UNIT_FIELD_BYTES_0); |
| 15268 | |
| 15269 | _iter->second->unArenaInfoId0 = GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (0 * 6)); |
| 15270 | _iter->second->unArenaInfoId1 = GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (1 * 6)); |
| 15271 | _iter->second->unArenaInfoId2 = GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (2 * 6)); |
| 15272 | } |