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

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++) {
SetAddonInteractable($"ChatLogPanel_{i}", interactable);
}
@ -249,7 +249,7 @@ internal unsafe class GameFunctions : IDisposable {
return (*flags & (1 << 22)) == 0;
}
internal void OpenItemTooltip(uint id) {
internal static void OpenItemTooltip(uint id) {
var atkStage = AtkStage.GetSingleton();
var agent = Framework.Instance()->GetUiModule()->GetAgentModule()->GetAgentByInternalId(AgentId.ItemDetail);
var addon = atkStage->RaptureAtkUnitManager->GetAddonByName("ItemDetail");
@ -289,7 +289,7 @@ internal unsafe class GameFunctions : IDisposable {
(*vf5)(addon, 0, 15);
}
internal void CloseItemTooltip() {
internal static void CloseItemTooltip() {
// hide addon first to prevent the "addon close" sound
var addon = AtkStage.GetSingleton()->RaptureAtkUnitManager->GetAddonByName("ItemDetail");
if (addon != null) {
@ -382,7 +382,6 @@ internal unsafe class GameFunctions : IDisposable {
// 0x10005: copy item name
// 0x10006: search recipes using this material
internal void TryOn(uint itemId, byte stainId) {
if (this._tryOn == null) {
return;

View File

@ -32,7 +32,7 @@ internal sealed class PayloadHandler {
this.DrawPopups();
if (this._handleTooltips && ++this._hoverCounter - this._lastHoverCounter > 1) {
this.Ui.Plugin.Functions.CloseItemTooltip();
GameFunctions.CloseItemTooltip();
this._hoveredItem = 0;
this._hoverCounter = this._lastHoverCounter = 0;
this._handleTooltips = false;
@ -91,7 +91,7 @@ internal sealed class PayloadHandler {
}
case ItemPayload item: {
if (this.Ui.Plugin.Config.NativeItemTooltips) {
this.Ui.Plugin.Functions.OpenItemTooltip(item.ItemId);
GameFunctions.OpenItemTooltip(item.ItemId);
this._handleTooltips = true;
if (this._hoveredItem != item.ItemId) {

View File

@ -66,7 +66,7 @@ public sealed class Plugin : IDalamudPlugin {
public void Dispose() {
this.Framework.Update -= this.FrameworkUpdate;
this.Functions.SetChatInteractable(true);
GameFunctions.SetChatInteractable(true);
this.Ui.Dispose();
this.Store.Dispose();

View File

@ -197,7 +197,7 @@ internal sealed class Settings : IUiComponent {
}
if (!this._hideChat && hideChatChanged) {
this.Ui.Plugin.Functions.SetChatInteractable(true);
GameFunctions.SetChatInteractable(true);
}
this.Initialise();