Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
area363 committed Jul 16, 2024
1 parent 4eb4c45 commit d7884d8
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ private void ProcessTasks(Task<List<ICommittedActionEvaluation>>[] taskArray, IB
// check if address is already in _avatarCheck
if (!_avatarCheck.Contains(avatarAddress.ToString()))
{
_avatarList.Add(AvatarData.GetAvatarInfo(outputState, ae.InputContext.Signer, hasAction.AvatarAddress, hasAction.RuneInfos, _blockTimeOffset, BattleType.Adventure));
_avatarList.Add(AvatarData.GetAvatarInfo(outputState, ae.InputContext.Signer, hasAction.AvatarAddress, _blockTimeOffset, BattleType.Adventure));
_avatarCheck.Add(avatarAddress.ToString());
}

Expand Down Expand Up @@ -473,7 +473,7 @@ private void ProcessTasks(Task<List<ICommittedActionEvaluation>>[] taskArray, IB
if (action is HackAndSlashSweep hasSweep)
{
var start = DateTimeOffset.UtcNow;
_avatarList.Add(AvatarData.GetAvatarInfo(outputState, ae.InputContext.Signer, hasSweep.avatarAddress, hasSweep.runeInfos, _blockTimeOffset, BattleType.Adventure));
_avatarList.Add(AvatarData.GetAvatarInfo(outputState, ae.InputContext.Signer, hasSweep.avatarAddress, _blockTimeOffset, BattleType.Adventure));
_hackAndSlashSweepList.Add(HackAndSlashSweepData.GetHackAndSlashSweepInfo(
inputState,
outputState,
Expand Down Expand Up @@ -821,7 +821,7 @@ private void ProcessTasks(Task<List<ICommittedActionEvaluation>>[] taskArray, IB
if (action is BattleArena battleArena)
{
var start = DateTimeOffset.UtcNow;
_avatarList.Add(AvatarData.GetAvatarInfo(outputState, ae.InputContext.Signer, battleArena.myAvatarAddress, battleArena.runeInfos, _blockTimeOffset, BattleType.Adventure));
_avatarList.Add(AvatarData.GetAvatarInfo(outputState, ae.InputContext.Signer, battleArena.myAvatarAddress, _blockTimeOffset, BattleType.Adventure));
_battleArenaList.Add(BattleArenaData.GetBattleArenaInfo(
inputState,
outputState,
Expand Down Expand Up @@ -1054,7 +1054,7 @@ private void ProcessTasks(Task<List<ICommittedActionEvaluation>>[] taskArray, IB
}
}

_avatarList.Add(AvatarData.GetAvatarInfo(outputState, ae.InputContext.Signer, raid.AvatarAddress, raid.RuneInfos, _blockTimeOffset, BattleType.Adventure));
_avatarList.Add(AvatarData.GetAvatarInfo(outputState, ae.InputContext.Signer, raid.AvatarAddress, _blockTimeOffset, BattleType.Adventure));

var worldBossListSheet = sheets.GetSheet<WorldBossListSheet>();
int raidId = worldBossListSheet.FindRaidIdByBlockIndex(ae.InputContext.BlockIndex);
Expand Down
19 changes: 10 additions & 9 deletions NineChronicles.DataProvider/DataRendering/AvatarData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ public static AvatarModel GetAvatarInfo(
IWorld outputStates,
Address signer,
Address avatarAddress,
List<RuneSlotInfo> runeInfos,
DateTimeOffset blockTime,
BattleType battleType)
{
var start = DateTimeOffset.UtcNow;
AvatarState avatarState = outputStates.GetAvatarState(avatarAddress);
var collectionExist = outputStates.TryGetCollectionState(avatarAddress, out var collectionState);
var sheetTypes = new List<Type>
Expand Down Expand Up @@ -151,14 +151,6 @@ public static AvatarModel GetAvatarInfo(

string avatarName = avatarState.name;

Log.Debug(
"AvatarName: {0}, AvatarLevel: {1}, ArmorId: {2}, TitleId: {3}, CP: {4}",
avatarName,
avatarLevel,
avatarArmorId,
avatarTitleId,
avatarCp);

var avatarModel = new AvatarModel()
{
Address = avatarAddress.ToString(),
Expand All @@ -171,6 +163,15 @@ public static AvatarModel GetAvatarInfo(
Timestamp = blockTime,
};

var end = DateTimeOffset.UtcNow;
Log.Debug(
"[DataProvider] AvatarName: {0}, AvatarLevel: {1}, ArmorId: {2}, TitleId: {3}, CP: {4}, Time Taken: {5} ms.",
avatarName,
avatarLevel,
avatarArmorId,
avatarTitleId,
avatarCp,
(end - start).Milliseconds);
return avatarModel;
}

Expand Down
Loading

0 comments on commit d7884d8

Please sign in to comment.