@@ -193,14 +193,21 @@ public static ArenaSheet.RoundData GetRoundData(IWorldState worldState, long blo
193193 /// <param name="worldState">The world state from which to retrieve the arena participants.</param>
194194 /// <param name="avatarAddrList">The list of avatar addresses to filter the matching participants.</param>
195195 /// <param name="avatarAddrAndScoresWithRank">The list of avatar addresses with their scores and ranks.</param>
196+ /// <param name="runeListSheet"></param>
197+ /// <param name="costumeStatSheet"></param>
198+ /// <param name="characterSheet"></param>
199+ /// <param name="runeOptionSheet"></param>
196200 /// <returns>A list of arena participants.</returns>
197- public static List < ArenaParticipant > GetArenaParticipants ( IWorldState worldState , List < Address > avatarAddrList , List < ( Address avatarAddr , int score , int rank ) > avatarAddrAndScoresWithRank )
201+ public static List < ArenaParticipant > GetArenaParticipants (
202+ IWorldState worldState ,
203+ List < Address > avatarAddrList ,
204+ List < ( Address avatarAddr , int score , int rank ) > avatarAddrAndScoresWithRank ,
205+ RuneListSheet runeListSheet ,
206+ CostumeStatSheet costumeStatSheet ,
207+ CharacterSheet characterSheet ,
208+ RuneOptionSheet runeOptionSheet
209+ )
198210 {
199- var runeListSheet = worldState . GetSheet < RuneListSheet > ( ) ;
200- var costumeSheet = worldState . GetSheet < CostumeStatSheet > ( ) ;
201- var characterSheet = worldState . GetSheet < CharacterSheet > ( ) ;
202- var runeOptionSheet = worldState . GetSheet < RuneOptionSheet > ( ) ;
203- var runeIds = runeListSheet . Values . Select ( x => x . Id ) . ToList ( ) ;
204211 var row = characterSheet [ GameConfig . DefaultAvatarCharacterId ] ;
205212 CollectionSheet collectionSheet = new CollectionSheet ( ) ;
206213 var collectionStates = worldState . GetCollectionStates ( avatarAddrList ) ;
@@ -265,7 +272,7 @@ List runeSlotList
265272 }
266273 }
267274
268- var cp = CPHelper . TotalCP ( equipments , costumes , runeOptions , avatar . level , row , costumeSheet , collectionModifiers ,
275+ var cp = CPHelper . TotalCP ( equipments , costumes , runeOptions , avatar . level , row , costumeStatSheet , collectionModifiers ,
269276 RuneHelper . CalculateRuneLevelBonus ( runeStates , runeListSheet , worldState . GetSheet < RuneLevelBonusSheet > ( ) )
270277 ) ;
271278 var portraitId = StateQuery . GetPortraitId ( equipments , costumes ) ;
@@ -315,7 +322,12 @@ public void PrepareArenaParticipants()
315322
316323 var avatarAddrList = participants . AvatarAddresses ;
317324 var avatarAddrAndScoresWithRank = AvatarAddrAndScoresWithRank ( avatarAddrList , currentRoundData , worldState ) ;
318- var result = GetArenaParticipants ( worldState , avatarAddrList , avatarAddrAndScoresWithRank ) ;
325+ var sheetCache = _cache . SheetCache ;
326+ var runeListSheet = sheetCache . GetSheet < RuneListSheet > ( worldState ) ;
327+ var costumeStatSheet = sheetCache . GetSheet < CostumeStatSheet > ( worldState ) ;
328+ var characterSheet = sheetCache . GetSheet < CharacterSheet > ( worldState ) ;
329+ var runeOptionSheet = sheetCache . GetSheet < RuneOptionSheet > ( worldState ) ;
330+ var result = GetArenaParticipants ( worldState , avatarAddrList , avatarAddrAndScoresWithRank , runeListSheet , costumeStatSheet , characterSheet , runeOptionSheet ) ;
319331 _cache . ArenaParticipantsCache . Set ( cacheKey , result , TimeSpan . FromHours ( 1 ) ) ;
320332 sw . Stop ( ) ;
321333 _logger . Information ( "[ArenaParticipantsWorker]Set Arena Cache[{CacheKey}]: {Elapsed}" , cacheKey , sw . Elapsed ) ;
0 commit comments