Skip to content

Commit

Permalink
add additional logs and remove avatar data rendering when DailyReward…
Browse files Browse the repository at this point in the history
… action is triggered
  • Loading branch information
area363 committed Jul 18, 2024
1 parent 2407a33 commit 7b46ed4
Show file tree
Hide file tree
Showing 5 changed files with 358 additions and 161 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
22 changes: 11 additions & 11 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 All @@ -38,7 +38,6 @@ public static AvatarModel GetAvatarInfo(
typeof(CostumeStatSheet),
typeof(RuneListSheet),
typeof(RuneOptionSheet),
typeof(CollectionSheet),
typeof(RuneLevelBonusSheet),
};
if (collectionExist)
Expand All @@ -63,7 +62,6 @@ public static AvatarModel GetAvatarInfo(
var runeSlotStates = new List<RuneSlotState>();
runeSlotStates.Add(runeSlotState);
var runes = SetRunes(runeSlotStates, battleType);

var equippedRuneStates = new List<RuneState>();
var runeIds = runes[battleType].GetRuneSlot()
.Where(slot => slot.RuneId.HasValue)
Expand Down Expand Up @@ -151,14 +149,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 +161,16 @@ public static AvatarModel GetAvatarInfo(
Timestamp = blockTime,
};

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

Expand Down
Loading

0 comments on commit 7b46ed4

Please sign in to comment.