Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Refresh.Common/RefreshContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ public enum RefreshContext
Aipi,
Presence,
Database,
CacheService,
}
18 changes: 15 additions & 3 deletions Refresh.Core/Extensions/GameAssetExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,11 @@ private static string TransformImage(this GameAsset asset, TokenGame game, IData
dataContext.DataStore,
_ => null,
() => asset.AsMainlinePhotoHash,
hash => dataContext.Database.SetMainlinePhotoHash(asset, hash),
hash =>
{
dataContext.Database.SetMainlinePhotoHash(asset, hash);
dataContext.Cache.CacheAsset(asset.AssetHash, asset);
},
() => throw new NotSupportedException(),
_ => throw new NotSupportedException()
);
Expand All @@ -172,9 +176,17 @@ private static string TransformImage(this GameAsset asset, TokenGame game, IData
dataContext.DataStore,
CropToIcon,
() => asset.AsMainlineIconHash,
hash => dataContext.Database.SetMainlineIconHash(asset, hash),
hash =>
{
dataContext.Database.SetMainlineIconHash(asset, hash);
dataContext.Cache.CacheAsset(asset.AssetHash, asset);
},
() => asset.AsMipIconHash,
hash => dataContext.Database.SetMipIconHash(asset, hash)
hash =>
{
dataContext.Database.SetMipIconHash(asset, hash);
dataContext.Cache.CacheAsset(asset.AssetHash, asset);
}
);
}

Expand Down
6 changes: 3 additions & 3 deletions Refresh.Core/Extensions/PhotoExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ public static SerializedPhoto FromGamePhoto(GamePhoto photo, DataContext dataCon
// NOTE: we usually would do `if psp, prepend psp/ to the hashes`,
// but since we are converting the psp TGA assets to PNG in FillInExtraData, we don't need to!
// also, I think the game would get mad if we did that
LargeHash = dataContext.Database.GetAssetFromHash(photo.LargeAsset.AssetHash)?.GetAsPhoto(dataContext.Game, dataContext) ?? photo.LargeAsset.AssetHash,
MediumHash = dataContext.Database.GetAssetFromHash(photo.MediumAsset.AssetHash)?.GetAsPhoto(dataContext.Game, dataContext) ?? photo.MediumAsset.AssetHash,
SmallHash = dataContext.Database.GetAssetFromHash(photo.SmallAsset.AssetHash)?.GetAsPhoto(dataContext.Game, dataContext) ?? photo.SmallAsset.AssetHash,
LargeHash = photo.LargeAsset.GetAsPhoto(dataContext.Game, dataContext) ?? photo.LargeAsset.AssetHash,
MediumHash = photo.MediumAsset.GetAsPhoto(dataContext.Game, dataContext) ?? photo.MediumAsset.AssetHash,
SmallHash = photo.SmallAsset.GetAsPhoto(dataContext.Game, dataContext) ?? photo.SmallAsset.AssetHash,
PlanHash = photo.PlanHash,
PhotoSubjects = [],
};
Expand Down
Loading
Loading