Skip to content

Commit

Permalink
Boost daily endeavours and remove starting wyrmite (#930)
Browse files Browse the repository at this point in the history
Closes #694. Removes the starting 1.2m wyrmite and updates the daily
endeavours as follows:

| Description | Original Reward | New Reward |
| ----------------------------------- | ------------------- |
------------------------ |
| Perform an Item Summon | 300 Eldwater | 3,000 Eldwater |
| Collect Rupies from a Facility | 1 Quality Honey | 5 Exquisite Honey |
| Clear a Quest | 5000 Mana | 3 Four Leaf Clovers |
| Clear Three Quests | 5 Consecrated Water | 1 Champion's Testament |
| Clear Five Quests | 1 Exquisite Honey | 1 Sunlight Ore |
| Clear All Standard Daily Endeavours | 50 Wyrmite | 1 Tenfold Summon
Voucher |

One tenfold per day (for active players) works out to between 280 and
310 summons a month, which is above the monthly average of between 135.6
(2022) to 238.7 (pre-2.0) summons that were offered for free while the
game was live -
[source](https://docs.google.com/spreadsheets/d/1ZEfbgzG1smvZD4qI8GLcJOk4Nh-lyOWGJzdg1aVzDZY/edit?gid=1356443011#gid=1356443011)

The boosted endeavour changes, since they are not technically vanilla,
can be disabled with a [feature
flag](https://github.com/SapiensAnatis/Dawnshard/wiki/Feature-flags).
  • Loading branch information
SapiensAnatis authored Jul 6, 2024
1 parent ee89214 commit 2f276e6
Show file tree
Hide file tree
Showing 14 changed files with 266 additions and 64 deletions.
2 changes: 1 addition & 1 deletion .csharpierignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
DragaliaAPI/DragaliaAPI.Database/Migrations/*
DragaliaAPI/DragaliaAPI.Database/Migrations/*
1 change: 1 addition & 0 deletions DragaliaAPI/DragaliaAPI.Integration.Test/TestFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ await apiContext.PlayerUserData.FindAsync(newPlayer.ViewerId)
)!;

userData.Coin = 100_000_000;
userData.Crystal = 1_200_000;
userData.DewPoint = 100_000_000;
userData.ManaPoint = 100_000_000;
userData.Level = 250;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

<ItemGroup>
<PackageReference Include="Basic.Reference.Assemblies" />
<PackageReference Include="FluentAssertions" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand All @@ -29,7 +30,6 @@

<ItemGroup>
<ProjectReference Include="..\DragaliaAPI.Shared.SourceGenerator\DragaliaAPI.Shared.SourceGenerator.csproj" />
<ProjectReference Include="..\DragaliaAPI.Shared\DragaliaAPI.Shared.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,22 @@ private static async Task<List<TItem>> LoadFile<TItem>(string msgpackPath)
) ?? throw new global::MessagePack.MessagePackSerializationException($"Deserialized MasterAsset extension for {path} was null");
}

public static async global::System.Threading.Tasks.Task<global::System.Collections.Generic.IEnumerable<global::DragaliaAPI.Shared.MasterAsset.Models.Event.EventData>> LoadEventDataExtension(global::Microsoft.FeatureManagement.IFeatureManager featureManager)
public static async global::System.Threading.Tasks.Task<global::System.Collections.Generic.IEnumerable<global::DragaliaAPI.Shared.MasterAsset.EventData>> LoadEventDataExtension(global::Microsoft.FeatureManagement.IFeatureManager featureManager)
{
global::System.Collections.Generic.List<global::DragaliaAPI.Shared.MasterAsset.Models.Event.EventData> extendedData = [];
global::System.Collections.Generic.List<global::DragaliaAPI.Shared.MasterAsset.EventData> extendedData = [];

extendedData.AddRange(await LoadFile<global::DragaliaAPI.Shared.MasterAsset.Models.Event.EventData>("Event/BuildEventReward.extension.msgpack"));
extendedData.AddRange(await LoadFile<global::DragaliaAPI.Shared.MasterAsset.EventData>("Event/BuildEventReward.extension.msgpack"));

return extendedData;
}

public static async global::System.Threading.Tasks.Task<global::System.Collections.Generic.IEnumerable<global::DragaliaAPI.Shared.MasterAsset.Models.DragonData>> LoadDragonDataExtension(global::Microsoft.FeatureManagement.IFeatureManager featureManager)
public static async global::System.Threading.Tasks.Task<global::System.Collections.Generic.IEnumerable<global::DragaliaAPI.Shared.MasterAsset.DragonData>> LoadDragonDataExtension(global::Microsoft.FeatureManagement.IFeatureManager featureManager)
{
global::System.Collections.Generic.List<global::DragaliaAPI.Shared.MasterAsset.Models.DragonData> extendedData = [];
global::System.Collections.Generic.List<global::DragaliaAPI.Shared.MasterAsset.DragonData> extendedData = [];

if (await featureManager.IsEnabledAsync("ModdedDragons"))
{
extendedData.AddRange(await LoadFile<global::DragaliaAPI.Shared.MasterAsset.Models.DragonData>("DragonData.modded.msgpack"));
extendedData.AddRange(await LoadFile<global::DragaliaAPI.Shared.MasterAsset.DragonData>("DragonData.modded.msgpack"));
}

return extendedData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,58 +11,58 @@ public static partial class MasterAsset

private static bool loaded;

private static global::DragaliaAPI.Shared.MasterAsset.MasterAssetData<global::DragaliaAPI.Shared.Definitions.Enums.Charas, global::DragaliaAPI.Shared.MasterAsset.Models.CharaData>? charaData;
public static global::DragaliaAPI.Shared.MasterAsset.MasterAssetData<global::DragaliaAPI.Shared.Definitions.Enums.Charas, global::DragaliaAPI.Shared.MasterAsset.Models.CharaData> CharaData => charaData ?? throw new InvalidOperationException(ErrorUninitialized);
private static global::DragaliaAPI.Shared.MasterAsset.MasterAssetData<global::DragaliaAPI.Shared.MasterAsset.Charas, global::DragaliaAPI.Shared.MasterAsset.CharaData>? charaData;
public static global::DragaliaAPI.Shared.MasterAsset.MasterAssetData<global::DragaliaAPI.Shared.MasterAsset.Charas, global::DragaliaAPI.Shared.MasterAsset.CharaData> CharaData => charaData ?? throw new InvalidOperationException(ErrorUninitialized);

private static global::DragaliaAPI.Shared.MasterAsset.MasterAssetData<int, global::DragaliaAPI.Shared.MasterAsset.Models.TimeAttack.RankingData>? rankingData;
public static global::DragaliaAPI.Shared.MasterAsset.MasterAssetData<int, global::DragaliaAPI.Shared.MasterAsset.Models.TimeAttack.RankingData> RankingData => rankingData ?? throw new InvalidOperationException(ErrorUninitialized);
private static global::DragaliaAPI.Shared.MasterAsset.MasterAssetData<int, global::DragaliaAPI.Shared.MasterAsset.RankingData>? rankingData;
public static global::DragaliaAPI.Shared.MasterAsset.MasterAssetData<int, global::DragaliaAPI.Shared.MasterAsset.RankingData> RankingData => rankingData ?? throw new InvalidOperationException(ErrorUninitialized);

private static global::DragaliaAPI.Shared.MasterAsset.MasterAssetGroup<int, int, global::DragaliaAPI.Shared.MasterAsset.Models.Event.BuildEventReward>? buildEventReward;
public static global::DragaliaAPI.Shared.MasterAsset.MasterAssetGroup<int, int, global::DragaliaAPI.Shared.MasterAsset.Models.Event.BuildEventReward> BuildEventReward => buildEventReward ?? throw new InvalidOperationException(ErrorUninitialized);
private static global::DragaliaAPI.Shared.MasterAsset.MasterAssetGroup<int, int, global::DragaliaAPI.Shared.MasterAsset.BuildEventReward>? buildEventReward;
public static global::DragaliaAPI.Shared.MasterAsset.MasterAssetGroup<int, int, global::DragaliaAPI.Shared.MasterAsset.BuildEventReward> BuildEventReward => buildEventReward ?? throw new InvalidOperationException(ErrorUninitialized);

private static global::DragaliaAPI.Shared.MasterAsset.MasterAssetData<int, global::DragaliaAPI.Shared.MasterAsset.Models.Event.EventData>? eventData;
public static global::DragaliaAPI.Shared.MasterAsset.MasterAssetData<int, global::DragaliaAPI.Shared.MasterAsset.Models.Event.EventData> EventData => eventData ?? throw new InvalidOperationException(ErrorUninitialized);
private static global::DragaliaAPI.Shared.MasterAsset.MasterAssetData<int, global::DragaliaAPI.Shared.MasterAsset.EventData>? eventData;
public static global::DragaliaAPI.Shared.MasterAsset.MasterAssetData<int, global::DragaliaAPI.Shared.MasterAsset.EventData> EventData => eventData ?? throw new InvalidOperationException(ErrorUninitialized);

private static global::DragaliaAPI.Shared.MasterAsset.MasterAssetData<global::DragaliaAPI.Shared.Definitions.Enums.Dragons, global::DragaliaAPI.Shared.MasterAsset.Models.DragonData>? dragonData;
public static global::DragaliaAPI.Shared.MasterAsset.MasterAssetData<global::DragaliaAPI.Shared.Definitions.Enums.Dragons, global::DragaliaAPI.Shared.MasterAsset.Models.DragonData> DragonData => dragonData ?? throw new InvalidOperationException(ErrorUninitialized);
private static global::DragaliaAPI.Shared.MasterAsset.MasterAssetData<int, global::DragaliaAPI.Shared.MasterAsset.DragonData>? dragonData;
public static global::DragaliaAPI.Shared.MasterAsset.MasterAssetData<int, global::DragaliaAPI.Shared.MasterAsset.DragonData> DragonData => dragonData ?? throw new InvalidOperationException(ErrorUninitialized);
public static async Task LoadAsync(global::Microsoft.FeatureManagement.IFeatureManager featureManager)
{
if (loaded)
{
return;
}

global::System.Threading.Tasks.ValueTask<global::DragaliaAPI.Shared.MasterAsset.MasterAssetData<global::DragaliaAPI.Shared.Definitions.Enums.Charas, global::DragaliaAPI.Shared.MasterAsset.Models.CharaData>> charaDataTask =
global::DragaliaAPI.Shared.MasterAsset.MasterAssetData.LoadAsync<global::DragaliaAPI.Shared.Definitions.Enums.Charas, global::DragaliaAPI.Shared.MasterAsset.Models.CharaData>(
global::System.Threading.Tasks.ValueTask<global::DragaliaAPI.Shared.MasterAsset.MasterAssetData<global::DragaliaAPI.Shared.MasterAsset.Charas, global::DragaliaAPI.Shared.MasterAsset.CharaData>> charaDataTask =
global::DragaliaAPI.Shared.MasterAsset.MasterAssetData.LoadAsync<global::DragaliaAPI.Shared.MasterAsset.Charas, global::DragaliaAPI.Shared.MasterAsset.CharaData>(
"CharaData.msgpack",
(global::DragaliaAPI.Shared.MasterAsset.Models.CharaData x) => x.Id,
(global::DragaliaAPI.Shared.MasterAsset.CharaData x) => x.Id,
null
);

global::System.Threading.Tasks.ValueTask<global::DragaliaAPI.Shared.MasterAsset.MasterAssetData<int, global::DragaliaAPI.Shared.MasterAsset.Models.TimeAttack.RankingData>> rankingDataTask =
global::DragaliaAPI.Shared.MasterAsset.MasterAssetData.LoadAsync<int, global::DragaliaAPI.Shared.MasterAsset.Models.TimeAttack.RankingData>(
global::System.Threading.Tasks.ValueTask<global::DragaliaAPI.Shared.MasterAsset.MasterAssetData<int, global::DragaliaAPI.Shared.MasterAsset.RankingData>> rankingDataTask =
global::DragaliaAPI.Shared.MasterAsset.MasterAssetData.LoadAsync<int, global::DragaliaAPI.Shared.MasterAsset.RankingData>(
"TimeAttack/RankingData.msgpack",
(global::DragaliaAPI.Shared.MasterAsset.Models.TimeAttack.RankingData x) => x.QuestId,
(global::DragaliaAPI.Shared.MasterAsset.RankingData x) => x.QuestId,
null
);

global::System.Threading.Tasks.ValueTask<global::DragaliaAPI.Shared.MasterAsset.MasterAssetGroup<int, int, global::DragaliaAPI.Shared.MasterAsset.Models.Event.BuildEventReward>> buildEventRewardTask =
global::DragaliaAPI.Shared.MasterAsset.MasterAssetGroup.LoadAsync<int, int, global::DragaliaAPI.Shared.MasterAsset.Models.Event.BuildEventReward>(
global::System.Threading.Tasks.ValueTask<global::DragaliaAPI.Shared.MasterAsset.MasterAssetGroup<int, int, global::DragaliaAPI.Shared.MasterAsset.BuildEventReward>> buildEventRewardTask =
global::DragaliaAPI.Shared.MasterAsset.MasterAssetGroup.LoadAsync<int, int, global::DragaliaAPI.Shared.MasterAsset.BuildEventReward>(
"Event/BuildEventReward.msgpack",
(global::DragaliaAPI.Shared.MasterAsset.Models.Event.BuildEventReward x) => x.Id
(global::DragaliaAPI.Shared.MasterAsset.BuildEventReward x) => x.Id
);

global::System.Threading.Tasks.ValueTask<global::DragaliaAPI.Shared.MasterAsset.MasterAssetData<int, global::DragaliaAPI.Shared.MasterAsset.Models.Event.EventData>> eventDataTask =
global::DragaliaAPI.Shared.MasterAsset.MasterAssetData.LoadAsync<int, global::DragaliaAPI.Shared.MasterAsset.Models.Event.EventData>(
global::System.Threading.Tasks.ValueTask<global::DragaliaAPI.Shared.MasterAsset.MasterAssetData<int, global::DragaliaAPI.Shared.MasterAsset.EventData>> eventDataTask =
global::DragaliaAPI.Shared.MasterAsset.MasterAssetData.LoadAsync<int, global::DragaliaAPI.Shared.MasterAsset.EventData>(
"Event/EventData.msgpack",
(global::DragaliaAPI.Shared.MasterAsset.Models.Event.EventData x) => x.Id,
(global::DragaliaAPI.Shared.MasterAsset.EventData x) => x.Id,
await LoadEventDataExtension(featureManager)
);

global::System.Threading.Tasks.ValueTask<global::DragaliaAPI.Shared.MasterAsset.MasterAssetData<global::DragaliaAPI.Shared.Definitions.Enums.Dragons, global::DragaliaAPI.Shared.MasterAsset.Models.DragonData>> dragonDataTask =
global::DragaliaAPI.Shared.MasterAsset.MasterAssetData.LoadAsync<global::DragaliaAPI.Shared.Definitions.Enums.Dragons, global::DragaliaAPI.Shared.MasterAsset.Models.DragonData>(
global::System.Threading.Tasks.ValueTask<global::DragaliaAPI.Shared.MasterAsset.MasterAssetData<int, global::DragaliaAPI.Shared.MasterAsset.DragonData>> dragonDataTask =
global::DragaliaAPI.Shared.MasterAsset.MasterAssetData.LoadAsync<int, global::DragaliaAPI.Shared.MasterAsset.DragonData>(
"DragonData.msgpack",
(global::DragaliaAPI.Shared.MasterAsset.Models.DragonData x) => x.Id,
(global::DragaliaAPI.Shared.MasterAsset.DragonData x) => x.Id,
await LoadDragonDataExtension(featureManager)
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Basic.Reference.Assemblies;
using DragaliaAPI.Shared.MasterAsset.Models;
using FluentAssertions;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;

Expand All @@ -11,12 +11,27 @@ public class MasterAssetGeneratorTest
public async Task GeneratesMasterAssetCorrectly()
{
string source = """
using DragaliaAPI.Shared.MasterAsset;
using DragaliaAPI.Shared.MasterAsset.Models;
using DragaliaAPI.Shared.MasterAsset.Models.TimeAttack;
using DragaliaAPI.Shared.MasterAsset.Models.Event;

[assembly: ExtendMasterAsset(nameof(MasterAsset.EventData), "Event/BuildEventReward.extension.json")]
[assembly: ExtendMasterAsset(nameof(MasterAsset.DragonData), "DragonData.modded.json", FeatureFlag = "ModdedDragons")]

namespace DragaliaAPI.Shared.MasterAsset;

public enum Charas
{
Illia,
}

public record CharaData(Charas Id);
public record RankingData(int QuestId);
public record BuildEventReward(int Id);
public record EventData(int Id);
public record DragonData(int Id);

[GenerateMasterAsset<CharaData>("CharaData.json")]
[GenerateMasterAsset<RankingData>("TimeAttack/RankingData.json", Key = nameof(Models.TimeAttack.RankingData.QuestId))]
[GenerateMasterAsset<BuildEventReward>("Event/BuildEventReward.json", Group = true)]
Expand All @@ -25,30 +40,18 @@ namespace DragaliaAPI.Shared.MasterAsset;
public static partial class MasterAsset
{
}

[ExtendMasterAsset(nameof(MasterAsset.EventData), "Event/BuildEventReward.extension.json")]
public static class EventDataExtensions
{
}

[ExtendMasterAsset(nameof(MasterAsset.DragonData), "DragonData.modded.json", FeatureFlag = "ModdedDragons")]
public static class DragonDataExtensions
{
}
""";

await Verify(source);
GeneratorDriver driver = GetDriver(source);

await Verify(driver);
}

private static Task Verify(string source)
private static GeneratorDriver GetDriver(string source)
{
SyntaxTree syntaxTree = CSharpSyntaxTree.ParseText(source);

List<PortableExecutableReference> references =
[
.. ReferenceAssemblies.Net80,
MetadataReference.CreateFromFile(typeof(CharaData).Assembly.Location)
];
List<PortableExecutableReference> references = [.. ReferenceAssemblies.Net80,];

CSharpCompilation compilation = CSharpCompilation.Create(
assemblyName: "Tests",
Expand All @@ -61,6 +64,9 @@ private static Task Verify(string source)

driver = driver.RunGenerators(compilation);

return Verifier.Verify(driver);
GeneratorDriverRunResult result = driver.GetRunResult();
result.Diagnostics.Should().BeEmpty();

return driver;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
static (_, _) => true,
Transforms.TransformExtensionDeclarations
)
.SelectMany(static (list, _) => list.AsEnumerable())
.Collect();

IncrementalValuesProvider<MasterAssetDeclaration> declarationProvider = context
Expand Down
35 changes: 26 additions & 9 deletions DragaliaAPI/DragaliaAPI.Shared.SourceGenerator/Transforms.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,24 +66,41 @@ is not IPropertySymbol keyPropertySymbol
}
}

public static MasterAssetExtensionDeclaration TransformExtensionDeclarations(
public static EquatableReadOnlyList<MasterAssetExtensionDeclaration> TransformExtensionDeclarations(
GeneratorAttributeSyntaxContext context,
CancellationToken cancellationToken
)
{
AttributeData attribute = context.Attributes[0];
cancellationToken.ThrowIfCancellationRequested();

return ProcessDeclarations(context, cancellationToken).ToEquatableReadOnlyList();

if (
attribute.ConstructorArguments
is not [{ Value: string masterAssetName }, { Value: string jsonPath }]
static IEnumerable<MasterAssetExtensionDeclaration> ProcessDeclarations(
GeneratorAttributeSyntaxContext context,
CancellationToken cancellationToken
)
{
return MasterAssetExtensionDeclaration.Default;
}
foreach (AttributeData? attribute in context.Attributes)
{
cancellationToken.ThrowIfCancellationRequested();

attribute.TryGetNamedArgument("FeatureFlag", out string? featureFlag);
if (
attribute.ConstructorArguments
is not [{ Value: string masterAssetName }, { Value: string jsonPath }]
)
{
continue;
}

attribute.TryGetNamedArgument("FeatureFlag", out string? featureFlag);

return new MasterAssetExtensionDeclaration(masterAssetName, jsonPath, featureFlag);
yield return new MasterAssetExtensionDeclaration(
masterAssetName,
jsonPath,
featureFlag
);
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ private static async Task<List<TItem>> LoadFile<TItem>(string msgpackPath)
) ?? throw new global::MessagePack.MessagePackSerializationException($"Deserialized MasterAsset extension for {path} was null");
}

public static async global::System.Threading.Tasks.Task<global::System.Collections.Generic.IEnumerable<global::DragaliaAPI.Shared.MasterAsset.Models.Missions.DailyMission>> LoadMissionDailyDataExtension(global::Microsoft.FeatureManagement.IFeatureManager featureManager)
{
global::System.Collections.Generic.List<global::DragaliaAPI.Shared.MasterAsset.Models.Missions.DailyMission> extendedData = [];

if (await featureManager.IsEnabledAsync("BoostedDailyEndeavourRewards"))
{
extendedData.AddRange(await LoadFile<global::DragaliaAPI.Shared.MasterAsset.Models.Missions.DailyMission>("Missions/MissionDailyData.rewards.msgpack"));
}

return extendedData;
}

public static async global::System.Threading.Tasks.Task<global::System.Collections.Generic.IEnumerable<global::DragaliaAPI.Shared.MasterAsset.Models.Event.EventData>> LoadEventDataExtension(global::Microsoft.FeatureManagement.IFeatureManager featureManager)
{
global::System.Collections.Generic.List<global::DragaliaAPI.Shared.MasterAsset.Models.Event.EventData> extendedData = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ public static async Task LoadAsync(global::Microsoft.FeatureManagement.IFeatureM
global::DragaliaAPI.Shared.MasterAsset.MasterAssetData.LoadAsync<int, global::DragaliaAPI.Shared.MasterAsset.Models.Missions.DailyMission>(
"Missions/MissionDailyData.msgpack",
(global::DragaliaAPI.Shared.MasterAsset.Models.Missions.DailyMission x) => x.Id,
null
await LoadMissionDailyDataExtension(featureManager)
);

global::System.Threading.Tasks.ValueTask<global::DragaliaAPI.Shared.MasterAsset.MasterAssetData<int, global::DragaliaAPI.Shared.MasterAsset.Models.Missions.DrillMission>> missionDrillDataTask =
Expand Down
Loading

0 comments on commit 2f276e6

Please sign in to comment.