Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions SamplePlugin/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public sealed class Plugin : IDalamudPlugin
[PluginService] internal static ITextureProvider TextureProvider { get; private set; } = null!;
[PluginService] internal static ICommandManager CommandManager { get; private set; } = null!;
[PluginService] internal static IClientState ClientState { get; private set; } = null!;
[PluginService] internal static IPlayerState PlayerState { get; private set; } = null!;
[PluginService] internal static IDataManager DataManager { get; private set; } = null!;
[PluginService] internal static IPluginLog Log { get; private set; } = null!;

Expand Down
2 changes: 1 addition & 1 deletion SamplePlugin/SamplePlugin.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Dalamud.NET.Sdk/13.1.0">
<Project Sdk="Dalamud.NET.Sdk/14.0.1">
<PropertyGroup>
<Version>0.0.0.1</Version>
<Description>A sample plugin.</Description>
Expand Down
31 changes: 16 additions & 15 deletions SamplePlugin/Windows/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void Dispose() { }

public override void Draw()
{
ImGui.TextUnformatted($"The random config bool is {plugin.Configuration.SomePropertyToBeSavedAndWithADefault}");
ImGui.Text($"The random config bool is {plugin.Configuration.SomePropertyToBeSavedAndWithADefault}");

if (ImGui.Button("Show Settings"))
{
Expand All @@ -50,7 +50,7 @@ public override void Draw()
// Check if this child is drawing
if (child.Success)
{
ImGui.TextUnformatted("Have a goat:");
ImGui.Text("Have a goat:");
var goatImage = Plugin.TextureProvider.GetFromFile(goatImagePath).GetWrapOrDefault();
if (goatImage != null)
{
Expand All @@ -61,39 +61,40 @@ public override void Draw()
}
else
{
ImGui.TextUnformatted("Image not found.");
ImGui.Text("Image not found.");
}

ImGuiHelpers.ScaledDummy(20.0f);

// Example for other services that Dalamud provides.
// ClientState provides a wrapper filled with information about the local player object and client.
// PlayerState provides a wrapper filled with information about the player character.

var localPlayer = Plugin.ClientState.LocalPlayer;
if (localPlayer == null)
var playerState = Plugin.PlayerState;
if (!playerState.IsLoaded)
{
ImGui.TextUnformatted("Our local player is currently not loaded.");
ImGui.Text("Our local player is currently not logged in.");
return;
}

if (!localPlayer.ClassJob.IsValid)
if (!playerState.ClassJob.IsValid)
{
ImGui.TextUnformatted("Our current job is currently not valid.");
ImGui.Text("Our current job is currently not valid.");
return;
}

// If you want to see the Macro representation of this SeString use `ToMacroString()`
ImGui.TextUnformatted($"Our current job is ({localPlayer.ClassJob.RowId}) \"{localPlayer.ClassJob.Value.Abbreviation}\"");
// If you want to see the Macro representation of this SeString use `.ToMacroString()`
// More info about SeStrings: https://dalamud.dev/plugin-development/sestring/
ImGui.Text($"Our current job is ({playerState.ClassJob.RowId}) '{playerState.ClassJob.Value.Abbreviation}' with level {playerState.Level}");

// Example for quarrying Lumina directly, getting the name of our current area.
// Example for querying Lumina, getting the name of our current area.
var territoryId = Plugin.ClientState.TerritoryType;
if (Plugin.DataManager.GetExcelSheet<TerritoryType>().TryGetRow(territoryId, out var territoryRow))
{
ImGui.TextUnformatted($"We are currently in ({territoryId}) \"{territoryRow.PlaceName.Value.Name}\"");
ImGui.Text($"We are currently in ({territoryId}) '{territoryRow.PlaceName.Value.Name}'");
}
else
{
ImGui.TextUnformatted("Invalid territory.");
ImGui.Text("Invalid territory.");
}
}
}
Expand Down
14 changes: 7 additions & 7 deletions SamplePlugin/packages.lock.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"version": 1,
"dependencies": {
"net9.0-windows7.0": {
"net10.0-windows7.0": {
"DalamudPackager": {
"type": "Direct",
"requested": "[13.1.0, )",
"resolved": "13.1.0",
"contentHash": "XdoNhJGyFby5M/sdcRhnc5xTop9PHy+H50PTWpzLhJugjB19EDBiHD/AsiDF66RETM+0qKUdJBZrNuebn7qswQ=="
"requested": "[14.0.1, )",
"resolved": "14.0.1",
"contentHash": "y0WWyUE6dhpGdolK3iKgwys05/nZaVf4ZPtIjpLhJBZvHxkkiE23zYRo7K7uqAgoK/QvK5cqF6l3VG5AbgC6KA=="
},
"DotNet.ReproducibleBuilds": {
"type": "Direct",
"requested": "[1.2.25, )",
"resolved": "1.2.25",
"contentHash": "xCXiw7BCxHJ8pF6wPepRUddlh2dlQlbr81gXA72hdk4FLHkKXas7EH/n+fk5UCA/YfMqG1Z6XaPiUjDbUNBUzg=="
"requested": "[1.2.39, )",
"resolved": "1.2.39",
"contentHash": "fcFN01tDTIQqDuTwr1jUQK/geofiwjG5DycJQOnC72i1SsLAk1ELe+apBOuZ11UMQG8YKFZG1FgvjZPbqHyatg=="
}
}
}
Expand Down