diff --git a/NineChronicles.DataProvider/RenderSubscriber.cs b/NineChronicles.DataProvider/RenderSubscriber.cs index 177ae7fd..a131d2c9 100644 --- a/NineChronicles.DataProvider/RenderSubscriber.cs +++ b/NineChronicles.DataProvider/RenderSubscriber.cs @@ -1240,6 +1240,7 @@ protected override Task ExecuteAsync(CancellationToken stoppingToken) typeof(RuneSheet), typeof(RuneListSheet), typeof(RuneOptionSheet), + typeof(WorldBossListSheet), }); var runeSheet = sheets.GetSheet(); @@ -1273,40 +1274,22 @@ protected override Task ExecuteAsync(CancellationToken stoppingToken) _avatarList.Add(AvatarData.GetAvatarInfo(outputState, ev.Signer, ev.Action.AvatarAddress, ev.Action.RuneInfos, _blockTimeOffset)); - int raidId = 0; - bool found = false; - for (int i = 0; i < 99; i++) - { - if (outputState.Delta.UpdatedAddresses.Contains( - Addresses.GetRaiderAddress(ev.Action.AvatarAddress, i))) - { - raidId = i; - found = true; - break; - } - } - - if (found) - { - RaiderState raiderState = - outputState.GetRaiderState(ev.Action.AvatarAddress, raidId); - var model = new RaiderModel( - raidId, - raiderState.AvatarName, - raiderState.HighScore, - raiderState.TotalScore, - raiderState.Cp, - raiderState.IconId, - raiderState.Level, - raiderState.AvatarAddress.ToHex(), - raiderState.PurchaseCount); - _raiderList.Add(RaidData.GetRaidInfo(raidId, raiderState)); - MySqlStore.StoreRaider(model); - } - else - { - Log.Error("can't find raidId."); - } + var worldBossListSheet = sheets.GetSheet(); + int raidId = worldBossListSheet.FindRaidIdByBlockIndex(ev.BlockIndex); + RaiderState raiderState = + outputState.GetRaiderState(ev.Action.AvatarAddress, raidId); + var model = new RaiderModel( + raidId, + raiderState.AvatarName, + raiderState.HighScore, + raiderState.TotalScore, + raiderState.Cp, + raiderState.IconId, + raiderState.Level, + raiderState.AvatarAddress.ToHex(), + raiderState.PurchaseCount); + _raiderList.Add(RaidData.GetRaidInfo(raidId, raiderState)); + MySqlStore.StoreRaider(model); } } catch (Exception e)