2018-09-02 18:31:34 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
2021-12-10 02:58:30 +00:00
|
|
|
|
namespace PKHeX.Core;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Modifies contents of boxes by using an <see cref="Action"/> to change data.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public sealed class BoxManipModify : BoxManipBase
|
2018-09-02 18:31:34 +00:00
|
|
|
|
{
|
2021-12-10 02:58:30 +00:00
|
|
|
|
private readonly Action<PKM> Action;
|
|
|
|
|
public BoxManipModify(BoxManipType type, Action<PKM> action) : this(type, action, _ => true) { }
|
|
|
|
|
public BoxManipModify(BoxManipType type, Action<PKM> action, Func<SaveFile, bool> usable) : base(type, usable) => Action = action;
|
2018-09-02 18:31:34 +00:00
|
|
|
|
|
2021-12-10 02:58:30 +00:00
|
|
|
|
public override string GetPrompt(bool all) => string.Empty;
|
|
|
|
|
public override string GetFail(bool all) => string.Empty;
|
|
|
|
|
public override string GetSuccess(bool all) => string.Empty;
|
2018-09-02 18:31:34 +00:00
|
|
|
|
|
2021-12-10 02:58:30 +00:00
|
|
|
|
public override int Execute(SaveFile sav, BoxManipParam param)
|
|
|
|
|
{
|
|
|
|
|
var (start, stop, _) = param;
|
|
|
|
|
return sav.ModifyBoxes(Action, start, stop);
|
2018-09-02 18:31:34 +00:00
|
|
|
|
}
|
2022-06-18 18:04:24 +00:00
|
|
|
|
}
|