chore: update to new Lumina

This commit is contained in:
Anna 2020-11-23 13:22:19 -05:00
parent 37ddbc751b
commit 6d8f04bace
6 changed files with 66 additions and 26 deletions

View File

@ -6,7 +6,7 @@ namespace NoSoliciting.Tests.DefinitionsTests.Global {
this.Def = fixture.defs.Global["free_company"];
}
public static object[][] DataPositives => DefUtils.DataFromMessages(new TestMessage[] {
public static object[][] DataPositives => DefUtils.DataFromMessages(new[] {
// chat
new TestMessage(ChatType.Shout, "PhD: Phantasy Degree is a Rank 30 FC with a Large plot, 24/7 FC/EXP Buffs. There are NO Level Restrictions to join, we take new and old players. Ask to join or apply."),
new TestMessage(ChatType.Shout, "Wind up fc is a small company looking for new/seasoned adventures to join! If you need help with the msq/clear the latest raid well do our best to help! Send a tell/app to join"),
@ -40,7 +40,7 @@ namespace NoSoliciting.Tests.DefinitionsTests.Global {
new TestMessage("Sol Verinia FC is recruiting! We accept all levels, looking for active members. We look forward to you becoming one of the spire."),
});
public static object[][] DataNegatives => DefUtils.DataFromMessages(new TestMessage[] {
public static object[][] DataNegatives => DefUtils.DataFromMessages(new[] {
new TestMessage("Static recruit. Not hardcore. Discord needed. tues-thurs 11:30pmEST. Join if you have questions."),
new TestMessage("LF new LGBT friends to chill with in Eorzea! Join up, let's chat, and hang out. I have discord as well :)"),
new TestMessage("(Bored)Lovely Au Ra woman [Famfrit] available to be RP girlfriend/wife for long term or short term. Send tell if in need."),

View File

@ -6,7 +6,7 @@ namespace NoSoliciting.Tests.DefinitionsTests.PartyFinder {
this.Def = fixture.defs.PartyFinder["rmt"];
}
public static object[][] DataPositives => DefUtils.DataFromStrings(new string[] {
public static object[][] DataPositives => DefUtils.DataFromStrings(new[] {
"「Best Prices」《 Shiva Unreal ★ Warrior of Light ★ Ultimates ★ Eden's Verse i500/i505",
"「 MINMAXØ 」 SALES ≪ ❶ Savage 一 ❷ Ultimates 一 ❸ Mounts Etc. ≫ World #1 teams, instant delivery. Discord → azrael#6447",
"「」™️ Found it Cheaper? We will beat it! $elling EdenVerse, BLU, Ultimates, Primals, Discord: Valentine#5943",
@ -22,7 +22,7 @@ namespace NoSoliciting.Tests.DefinitionsTests.PartyFinder {
"☀5.4 Pre-orders☀Savage☀Trials☀Ultimates☀BLU 「DISCORD」⇒ Meliora#2500",
});
public static object[][] DataNegatives => DefUtils.DataFromStrings(new string[] {
public static object[][] DataNegatives => DefUtils.DataFromStrings(new[] {
"Doing Art commission of your charactet with good price! more info add me on discord: d0uglaz#7409 ♥",
"Selling HQ 490 DoH/DoL sets, just in time for the Ishgard restoration project. Cheaper than MB, Whipser or join for info.",
"Looking to sell medium odder otter walls(2mil) join or tell.",

View File

@ -15,7 +15,6 @@ namespace NoSoliciting {
['\ue057'] = "3",
['\ue058'] = "4",
['\ue059'] = "5",
['\ue099'] = "10",
['\ue09a'] = "11",
['\ue09b'] = "12",
@ -93,9 +92,10 @@ namespace NoSoliciting {
continue;
}
AppendNormal:
AppendNormal:
builder.Append(c);
}
input = builder.ToString();
// NFKD unicode normalisation
@ -128,27 +128,53 @@ namespace NoSoliciting {
if (cat.MainHand != 0) {
return Slot.MainHand;
} else if (cat.Head != 0) {
}
if (cat.Head != 0) {
return Slot.Head;
} else if (cat.Body != 0) {
}
if (cat.Body != 0) {
return Slot.Chest;
} else if (cat.Gloves != 0) {
}
if (cat.Gloves != 0) {
return Slot.Hands;
} else if (cat.Waist != 0) {
}
if (cat.Waist != 0) {
return Slot.Waist;
} else if (cat.Legs != 0) {
}
if (cat.Legs != 0) {
return Slot.Legs;
} else if (cat.Feet != 0) {
}
if (cat.Feet != 0) {
return Slot.Feet;
} else if (cat.OffHand != 0) {
}
if (cat.OffHand != 0) {
return Slot.OffHand;
} else if (cat.Ears != 0) {
}
if (cat.Ears != 0) {
return Slot.Earrings;
} else if (cat.Neck != 0) {
}
if (cat.Neck != 0) {
return Slot.Neck;
} else if (cat.FingerL != 0) {
}
if (cat.Wrists != 0) {
return Slot.Wrist;
}
if (cat.FingerL != 0) {
return Slot.RingL;
} else if (cat.FingerR != 0) {
}
if (cat.FingerR != 0) {
return Slot.RingR;
}

View File

@ -55,9 +55,9 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\Lumina.dll</HintPath>
</Reference>
<Reference Include="Lumina.Generated, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Lumina.Excel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\Lumina.Generated.dll</HintPath>
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\Lumina.Excel.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>

View File

@ -18,10 +18,10 @@ namespace NoSoliciting {
public Definitions Definitions { get; private set; }
private readonly List<Message> messageHistory = new List<Message>();
public IReadOnlyCollection<Message> MessageHistory { get => this.messageHistory; }
public IEnumerable<Message> MessageHistory { get => this.messageHistory; }
private readonly List<Message> partyFinderHistory = new List<Message>();
public IReadOnlyCollection<Message> PartyFinderHistory { get => this.partyFinderHistory; }
public IEnumerable<Message> PartyFinderHistory { get => this.partyFinderHistory; }
public void Initialize(DalamudPluginInterface pluginInterface) {
this.Interface = pluginInterface ?? throw new ArgumentNullException(nameof(pluginInterface), "DalamudPluginInterface cannot be null");

View File

@ -15,7 +15,7 @@ using System.Threading.Tasks;
namespace NoSoliciting {
public class PluginUI {
private readonly Plugin plugin;
private bool resizeWindow = false;
private bool resizeWindow;
private ReportStatus lastReportStatus = ReportStatus.None;
private bool _showSettings;
@ -175,11 +175,13 @@ namespace NoSoliciting {
substrings[i] = input;
}
}
ImGui.SameLine();
ImGui.PushFont(UiBuilder.IconFont);
if (ImGui.Button($"{FontAwesomeIcon.Trash.ToIconString()}##{name}-substring-{i}-remove")) {
substrings.RemoveAt(i);
}
ImGui.PopFont();
}
@ -187,6 +189,7 @@ namespace NoSoliciting {
if (ImGui.Button($"{FontAwesomeIcon.Plus.ToIconString()}##{name}-substring-add")) {
substrings.Add("");
}
ImGui.PopFont();
ImGui.EndChild();
@ -205,15 +208,18 @@ namespace NoSoliciting {
} catch (ArgumentException) {
valid = false;
}
if (valid && input.Length != 0) {
regexes[i] = input;
}
}
ImGui.SameLine();
ImGui.PushFont(UiBuilder.IconFont);
if (ImGui.Button($"{FontAwesomeIcon.Trash.ToIconString()}##{name}-regex-{i}-remove")) {
regexes.RemoveAt(i);
}
ImGui.PopFont();
}
@ -221,6 +227,7 @@ namespace NoSoliciting {
if (ImGui.Button($"{FontAwesomeIcon.Plus.ToIconString()}##{name}-regex-add")) {
regexes.Add("");
}
ImGui.PopFont();
ImGui.EndChild();
@ -270,7 +277,7 @@ namespace NoSoliciting {
if (ImGui.BeginTabBar("##report-tabs")) {
if (ImGui.BeginTabItem("Chat##chat-report")) {
float[] maxSizes = { 0f, 0f, 0f, 0f };
float[] maxSizes = {0f, 0f, 0f, 0f};
if (ImGui.BeginChild("##chat-messages", new Vector2(-1, -1))) {
ImGui.Columns(5);
@ -299,9 +306,11 @@ namespace NoSoliciting {
this.SetUpReportModal(message);
}
for (int idx = 0; idx < maxSizes.Length; idx++) {
ImGui.SetColumnWidth(idx, maxSizes[idx] + ImGui.GetStyle().ItemSpacing.X * 2);
}
ImGui.Columns(1);
ImGui.EndChild();
@ -311,7 +320,7 @@ namespace NoSoliciting {
}
if (ImGui.BeginTabItem("Party Finder##pf-report")) {
float[] maxSizes = { 0f, 0f, 0f };
float[] maxSizes = {0f, 0f, 0f};
if (ImGui.BeginChild("##pf-messages", new Vector2(-1, -1))) {
ImGui.Columns(4);
@ -340,13 +349,16 @@ namespace NoSoliciting {
this.SetUpReportModal(message);
}
for (int idx = 0; idx < maxSizes.Length; idx++) {
ImGui.SetColumnWidth(idx, maxSizes[idx] + ImGui.GetStyle().ItemSpacing.X * 2);
}
ImGui.Columns(1);
ImGui.EndChild();
}
ImGui.EndTabItem();
}
@ -388,9 +400,8 @@ namespace NoSoliciting {
using WebClient client = new WebClient();
this.lastReportStatus = ReportStatus.InProgress;
resp = await client.UploadStringTaskAsync(this.plugin.Definitions.ReportUrl, message.ToJson()).ConfigureAwait(true);
#pragma warning disable CA1031 // Do not catch general exception types
} catch (Exception) { }
#pragma warning restore CA1031 // Do not catch general exception types
this.lastReportStatus = resp == "{\"message\":\"ok\"}" ? ReportStatus.Successful : ReportStatus.Failure;
PluginLog.Log($"Report sent. Response: {resp}");
});
@ -426,14 +437,17 @@ namespace NoSoliciting {
if (last) {
ImGui.PushTextWrapPos();
}
ImGui.TextUnformatted(arg);
if (last) {
ImGui.PopTextWrapPos();
}
clicked = clicked || ImGui.IsItemClicked();
if (!last) {
maxSizes[i] = Math.Max(maxSizes[i], ImGui.CalcTextSize(arg).X);
}
ImGui.NextColumn();
}