Skip to content

Commit

Permalink
Removed intermediate save from update plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
sven-n committed Jan 1, 2025
1 parent 978dc95 commit a738c13
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,16 @@ protected override async ValueTask ApplyAsync(IContext context, GameConfiguratio
{
spirit.MaximumItemLevel = 1;
var maps = gameConfiguration.Maps;
if (gameConfiguration.DropItemGroups.Single(dig => dig.Description == "Dark Horse Spirit") is { } horseGroup
&& gameConfiguration.DropItemGroups.Single(dig => dig.Description == "Dark Raven Spirit") is { } ravenGroup)
if (gameConfiguration.DropItemGroups.Single(dig => dig.Description == "Dark Horse Spirit") is { } oldHorseGroup
&& gameConfiguration.DropItemGroups.Single(dig => dig.Description == "Dark Raven Spirit") is { } oldRavenGroup)
{
ClearDropItemGroup(horseGroup);
ClearDropItemGroup(ravenGroup);
await context.SaveChangesAsync().ConfigureAwait(false);
DeleteDropItemGroup(oldHorseGroup);
DeleteDropItemGroup(oldRavenGroup);
CreateDropItemGroup(0, "Dark Horse Spirit", 102);
CreateDropItemGroup(1, "Dark Raven Spirit", 96);
}

void ClearDropItemGroup(DropItemGroup group)
void DeleteDropItemGroup(DropItemGroup group)
{
group.PossibleItems.Clear();
foreach (var map in maps)
Expand All @@ -80,7 +79,7 @@ void ClearDropItemGroup(DropItemGroup group)
void CreateDropItemGroup(int itemLevel, string description, short minimumMonsterLevel)
{
var group = context.CreateNew<DropItemGroup>();
group.SetGuid(NumberConversionExtensions.MakeWord(13, 31).ToSigned(), (short)itemLevel);
group.SetGuid(NumberConversionExtensions.MakeWord(13, 31).ToSigned(), (short)itemLevel, 1);
group.ItemLevel = (byte)itemLevel;
group.Chance = 0.001;
group.Description = description;
Expand Down
4 changes: 2 additions & 2 deletions src/Persistence/Initialization/VersionSeasonSix/Items/Pets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ private void CreateSpirit()
this.GameConfiguration.Items.Add(spirit);

var horseDrop = this.Context.CreateNew<DropItemGroup>();
horseDrop.SetGuid(NumberConversionExtensions.MakeWord(13, 31).ToSigned(), 0);
horseDrop.SetGuid(NumberConversionExtensions.MakeWord(13, 31).ToSigned(), 0, 1);
horseDrop.ItemLevel = 0;
horseDrop.Chance = 0.001;
horseDrop.Description = "Dark Horse Spirit";
Expand All @@ -162,7 +162,7 @@ private void CreateSpirit()
BaseMapInitializer.RegisterDefaultDropItemGroup(horseDrop);

var ravenDrop = this.Context.CreateNew<DropItemGroup>();
ravenDrop.SetGuid(NumberConversionExtensions.MakeWord(13, 31).ToSigned(), 1);
ravenDrop.SetGuid(NumberConversionExtensions.MakeWord(13, 31).ToSigned(), 1, 1);
ravenDrop.ItemLevel = 1;
ravenDrop.Chance = 0.001;
ravenDrop.Description = "Dark Raven Spirit";
Expand Down

0 comments on commit a738c13

Please sign in to comment.