-
Notifications
You must be signed in to change notification settings - Fork 338
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #527 from ze-dom/bugfix/staff_rise_and_other_opts
Bugfix/staff rise and other opts
- Loading branch information
Showing
16 changed files
with
667 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/Persistence/Initialization/Updates/FixWeaponRisePercentagePlugIn075.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// <copyright file="FixWeaponRisePercentagePlugIn075.cs" company="MUnique"> | ||
// Licensed under the MIT License. See LICENSE file in the project root for full license information. | ||
// </copyright> | ||
|
||
namespace MUnique.OpenMU.Persistence.Initialization.Updates; | ||
|
||
using System.Runtime.InteropServices; | ||
using MUnique.OpenMU.PlugIns; | ||
|
||
/// <summary> | ||
/// This update fixes weapons (staff) rise percentage. | ||
/// </summary> | ||
[PlugIn(PlugInName, PlugInDescription)] | ||
[Guid("5B63534D-E5DF-46B1-992D-C1637B197EE1")] | ||
public class FixWeaponRisePercentagePlugIn075 : FixWeaponRisePercentagePlugInBase | ||
{ | ||
/// <inheritdoc /> | ||
public override string DataInitializationKey => Version075.DataInitialization.Id; | ||
|
||
/// <inheritdoc /> | ||
public override UpdateVersion Version => UpdateVersion.FixWeaponRisePercentage075; | ||
} |
22 changes: 22 additions & 0 deletions
22
src/Persistence/Initialization/Updates/FixWeaponRisePercentagePlugIn095d.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// <copyright file="FixWeaponRisePercentagePlugIn095d.cs" company="MUnique"> | ||
// Licensed under the MIT License. See LICENSE file in the project root for full license information. | ||
// </copyright> | ||
|
||
namespace MUnique.OpenMU.Persistence.Initialization.Updates; | ||
|
||
using System.Runtime.InteropServices; | ||
using MUnique.OpenMU.PlugIns; | ||
|
||
/// <summary> | ||
/// This update fixes weapons (staff) rise percentage. | ||
/// </summary> | ||
[PlugIn(PlugInName, PlugInDescription)] | ||
[Guid("33259706-F3DF-4F4D-9935-3DEF7E53BF81")] | ||
public class FixWeaponRisePercentagePlugIn095D : FixWeaponRisePercentagePlugInBase | ||
{ | ||
/// <inheritdoc /> | ||
public override string DataInitializationKey => Version095d.DataInitialization.Id; | ||
|
||
/// <inheritdoc /> | ||
public override UpdateVersion Version => UpdateVersion.FixWeaponRisePercentage095d; | ||
} |
82 changes: 82 additions & 0 deletions
82
src/Persistence/Initialization/Updates/FixWeaponRisePercentagePlugInBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
// <copyright file="FixWeaponRisePercentagePlugInBase.cs" company="MUnique"> | ||
// Licensed under the MIT License. See LICENSE file in the project root for full license information. | ||
// </copyright> | ||
|
||
namespace MUnique.OpenMU.Persistence.Initialization.Updates; | ||
|
||
using MUnique.OpenMU.DataModel.Configuration; | ||
using MUnique.OpenMU.DataModel.Configuration.Items; | ||
using MUnique.OpenMU.GameLogic.Attributes; | ||
using MUnique.OpenMU.Persistence.Initialization.Items; | ||
|
||
/// <summary> | ||
/// This update fixes weapons (staff) rise percentage. | ||
/// </summary> | ||
public abstract class FixWeaponRisePercentagePlugInBase : UpdatePlugInBase | ||
{ | ||
/// <summary> | ||
/// The plug in name. | ||
/// </summary> | ||
internal const string PlugInName = "Fix Weapon Rise Percentage"; | ||
|
||
/// <summary> | ||
/// The plug in description. | ||
/// </summary> | ||
internal const string PlugInDescription = "This update fixes weapons (staff) rise percentage"; | ||
|
||
/// <inheritdoc /> | ||
public override string Name => PlugInName; | ||
|
||
/// <inheritdoc /> | ||
public override string Description => PlugInDescription; | ||
|
||
/// <inheritdoc /> | ||
public override bool IsMandatory => true; | ||
|
||
/// <inheritdoc /> | ||
public override DateTime CreatedAt => new(2024, 11, 11, 16, 0, 0, DateTimeKind.Utc); | ||
|
||
/// <inheritdoc /> | ||
protected override async ValueTask ApplyAsync(IContext context, GameConfiguration gameConfiguration) | ||
{ | ||
var staffRiseBonusTable = gameConfiguration.ItemLevelBonusTables.Single(bt => bt.Name == "Staff Rise"); | ||
|
||
// Modify existing table name and description | ||
staffRiseBonusTable.Name = "Staff Rise (even)"; | ||
staffRiseBonusTable.Description = "The staff rise bonus per item level for even magic power staves."; | ||
|
||
// Add new staff odd increase table | ||
float[] staffRiseIncreaseByLevelOdd = { 0, 4, 7, 11, 14, 18, 21, 25, 28, 32, 36, 40, 45, 51, 57, 63 }; | ||
|
||
var staffOddTable = context.CreateNew<ItemLevelBonusTable>(); | ||
gameConfiguration.ItemLevelBonusTables.Add(staffOddTable); | ||
staffOddTable.Name = "Staff Rise (odd)"; | ||
staffOddTable.Description = "The staff rise bonus per item level for odd magic power staves."; | ||
for (int level = 0; level < staffRiseIncreaseByLevelOdd.Length; level++) | ||
{ | ||
var value = staffRiseIncreaseByLevelOdd[level]; | ||
if (value != 0) | ||
{ | ||
var levelBonus = context.CreateNew<LevelBonus>(); | ||
levelBonus.Level = level; | ||
levelBonus.AdditionalValue = staffRiseIncreaseByLevelOdd[level]; | ||
staffOddTable.BonusPerLevel.Add(levelBonus); | ||
} | ||
} | ||
|
||
// Fix Group 5 weapons (staves) | ||
var staves = gameConfiguration.Items.Where(i => i.Group == (int)ItemGroups.Staff && i.BasePowerUpAttributes.Any(pua => pua.TargetAttribute == Stats.StaffRise)); | ||
foreach (var staff in staves) | ||
{ | ||
if (staff.BasePowerUpAttributes.FirstOrDefault(pua => pua.TargetAttribute == Stats.StaffRise) is { } staffRiseAttr) | ||
{ | ||
if ((int)staffRiseAttr.BaseValue % 2 != 0) | ||
{ | ||
staffRiseAttr.BonusPerLevelTable = staffOddTable; | ||
} | ||
|
||
staffRiseAttr.BaseValue /= 2.0f; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.