refactor: make some methods static

This commit is contained in:
Anna
2022-01-11 02:06:12 -05:00
parent 2883f78b4c
commit e5f61cc901
4 changed files with 7 additions and 8 deletions
+3 -4
View File
@@ -229,7 +229,7 @@ internal unsafe class GameFunctions : IDisposable {
} }
} }
internal void SetChatInteractable(bool interactable) { internal static void SetChatInteractable(bool interactable) {
for (var i = 0; i < 4; i++) { for (var i = 0; i < 4; i++) {
SetAddonInteractable($"ChatLogPanel_{i}", interactable); SetAddonInteractable($"ChatLogPanel_{i}", interactable);
} }
@@ -249,7 +249,7 @@ internal unsafe class GameFunctions : IDisposable {
return (*flags & (1 << 22)) == 0; return (*flags & (1 << 22)) == 0;
} }
internal void OpenItemTooltip(uint id) { internal static void OpenItemTooltip(uint id) {
var atkStage = AtkStage.GetSingleton(); var atkStage = AtkStage.GetSingleton();
var agent = Framework.Instance()->GetUiModule()->GetAgentModule()->GetAgentByInternalId(AgentId.ItemDetail); var agent = Framework.Instance()->GetUiModule()->GetAgentModule()->GetAgentByInternalId(AgentId.ItemDetail);
var addon = atkStage->RaptureAtkUnitManager->GetAddonByName("ItemDetail"); var addon = atkStage->RaptureAtkUnitManager->GetAddonByName("ItemDetail");
@@ -289,7 +289,7 @@ internal unsafe class GameFunctions : IDisposable {
(*vf5)(addon, 0, 15); (*vf5)(addon, 0, 15);
} }
internal void CloseItemTooltip() { internal static void CloseItemTooltip() {
// hide addon first to prevent the "addon close" sound // hide addon first to prevent the "addon close" sound
var addon = AtkStage.GetSingleton()->RaptureAtkUnitManager->GetAddonByName("ItemDetail"); var addon = AtkStage.GetSingleton()->RaptureAtkUnitManager->GetAddonByName("ItemDetail");
if (addon != null) { if (addon != null) {
@@ -382,7 +382,6 @@ internal unsafe class GameFunctions : IDisposable {
// 0x10005: copy item name // 0x10005: copy item name
// 0x10006: search recipes using this material // 0x10006: search recipes using this material
internal void TryOn(uint itemId, byte stainId) { internal void TryOn(uint itemId, byte stainId) {
if (this._tryOn == null) { if (this._tryOn == null) {
return; return;
+2 -2
View File
@@ -32,7 +32,7 @@ internal sealed class PayloadHandler {
this.DrawPopups(); this.DrawPopups();
if (this._handleTooltips && ++this._hoverCounter - this._lastHoverCounter > 1) { if (this._handleTooltips && ++this._hoverCounter - this._lastHoverCounter > 1) {
this.Ui.Plugin.Functions.CloseItemTooltip(); GameFunctions.CloseItemTooltip();
this._hoveredItem = 0; this._hoveredItem = 0;
this._hoverCounter = this._lastHoverCounter = 0; this._hoverCounter = this._lastHoverCounter = 0;
this._handleTooltips = false; this._handleTooltips = false;
@@ -91,7 +91,7 @@ internal sealed class PayloadHandler {
} }
case ItemPayload item: { case ItemPayload item: {
if (this.Ui.Plugin.Config.NativeItemTooltips) { if (this.Ui.Plugin.Config.NativeItemTooltips) {
this.Ui.Plugin.Functions.OpenItemTooltip(item.ItemId); GameFunctions.OpenItemTooltip(item.ItemId);
this._handleTooltips = true; this._handleTooltips = true;
if (this._hoveredItem != item.ItemId) { if (this._hoveredItem != item.ItemId) {
+1 -1
View File
@@ -66,7 +66,7 @@ public sealed class Plugin : IDalamudPlugin {
public void Dispose() { public void Dispose() {
this.Framework.Update -= this.FrameworkUpdate; this.Framework.Update -= this.FrameworkUpdate;
this.Functions.SetChatInteractable(true); GameFunctions.SetChatInteractable(true);
this.Ui.Dispose(); this.Ui.Dispose();
this.Store.Dispose(); this.Store.Dispose();
+1 -1
View File
@@ -197,7 +197,7 @@ internal sealed class Settings : IUiComponent {
} }
if (!this._hideChat && hideChatChanged) { if (!this._hideChat && hideChatChanged) {
this.Ui.Plugin.Functions.SetChatInteractable(true); GameFunctions.SetChatInteractable(true);
} }
this.Initialise(); this.Initialise();