-
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
111 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using ECommons; | ||
using ECommons.DalamudServices; | ||
using ECommons.EzIpcManager; | ||
using ECommons.Logging; | ||
using Lumina.Excel.GeneratedSheets; | ||
using Splatoon.SplatoonScripting; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace SplatoonScriptsOfficial.Generic; | ||
public class ArtisanCraftCommand : SplatoonScript | ||
{ | ||
public override HashSet<uint>? ValidTerritories { get; } = null; | ||
#nullable disable | ||
[EzIPC] Action<ushort, int> CraftItem; | ||
public override void OnSetup() | ||
{ | ||
EzIPC.Init(this, "Artisan"); | ||
} | ||
|
||
public override void OnEnable() | ||
{ | ||
Svc.Commands.AddHandler("/artisancraft", new(OnCommand)); | ||
} | ||
|
||
private void OnCommand(string command, string arguments) | ||
{ | ||
var split = arguments.Split(" "); | ||
if(int.TryParse(split[^1], out var amt)) | ||
{ | ||
arguments = split[0..^1].Join(" "); | ||
} | ||
else | ||
{ | ||
amt = 1; | ||
} | ||
var recipe = Svc.Data.GetExcelSheet<Recipe>().FirstOrDefault(x => arguments.EqualsIgnoreCase(x.ItemResult.Value.Name.ExtractText())) ?? Svc.Data.GetExcelSheet<Recipe>().FirstOrDefault(x => x.ItemResult.Value.Name.ExtractText().Contains(arguments, StringComparison.OrdinalIgnoreCase)); | ||
if(recipe != null) | ||
{ | ||
DuoLog.Information($"Crafting {recipe.ItemResult.Value.Name} x{amt}"); | ||
CraftItem((ushort)recipe.RowId, amt); | ||
} | ||
else | ||
{ | ||
DuoLog.Error("Can't find recipe"); | ||
} | ||
} | ||
|
||
public override void OnDisable() | ||
{ | ||
Svc.Commands.RemoveHandler("/artisancraft"); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using ECommons.ImGuiMethods; | ||
using ECommons.Logging; | ||
using ECommons.SimpleGui; | ||
using Splatoon.SplatoonScripting; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace SplatoonScriptsOfficial.Tests; | ||
public class GenericTest6 : SplatoonScript | ||
{ | ||
public override HashSet<uint>? ValidTerritories { get; } = null; | ||
|
||
public override Metadata? Metadata => new(2); | ||
|
||
public override void OnScriptUpdated(uint previousVersion) | ||
{ | ||
if(previousVersion < 2) | ||
{ | ||
PluginLog.Information("Updated"); | ||
new PopupWindow(() => | ||
{ | ||
ImGuiEx.Text($""" | ||
Warning: Splatoon Script | ||
{this.InternalData.Name} | ||
was updated. | ||
If you were using Sidewise Spark related functions, | ||
you must reconfigure the script. | ||
"""); | ||
}); | ||
} | ||
} | ||
} |