qstbak/Questionable/Questionable.Functions/ChatFunctions.cs
2026-08-17 20:27:25 +10:00

212 lines
8.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Runtime.CompilerServices;
using Dalamud.Game.ClientState.Objects.Types;
using Dalamud.Plugin.Services;
using LLib;
using Lumina.Excel.Sheets;
using Questionable.Model.Questing;
namespace Questionable.Functions;
internal sealed class ChatFunctions
{
[Serializable]
[CompilerGenerated]
private sealed class _003C_003Ec
{
public static readonly _003C_003Ec _003C_003E9 = new _003C_003Ec();
public static Func<Emote, bool> _003C_003E9__3_0;
public static Func<Emote, bool> _003C_003E9__3_1;
public static Func<Emote, (uint RowId, string Command)> _003C_003E9__3_2;
public static Func<(uint RowId, string Command), bool> _003C_003E9__3_3;
public static Func<(uint RowId, string Command), EEmote> _003C_003E9__3_4;
public static Func<(uint RowId, string Command), string> _003C_003E9__3_5;
internal bool _003C_002Ector_003Eb__3_0(Emote x)
{
return x.RowId != 0;
}
internal bool _003C_002Ector_003Eb__3_1(Emote x)
{
return x.TextCommand.IsValid;
}
internal (uint RowId, string Command) _003C_002Ector_003Eb__3_2(Emote x)
{
return (RowId: x.RowId, Command: x.TextCommand.Value.Command.ToString());
}
internal bool _003C_002Ector_003Eb__3_3((uint RowId, string Command) x)
{
int num = (_200E_206A_206F_202E_206D_206E_206F_202B_202B_206A_200D_206B_202B_200D_206D_200C_202B_200E_202B_200C_200C_206F_202D_206C_200D_206D_202C_206B_202E_206D_200C_202D_202B_206B_200C_206F_202B_202D_206B_202D_202E(x.Command) ? 1902035638 : 1902035637);
while (true)
{
int num2 = num;
int num3 = 1902035639;
int num4 = num2;
int num5 = num4 + num3;
int num6 = num4 & num3;
switch (num5 - (num6 + num6))
{
case 1:
return false;
case 2:
return _206E_202D_200C_202C_202E_200D_206C_202A_202D_206C_206A_202B_206D_202E_202B_200F_206F_206D_206F_206F_200D_206A_202E_202A_206A_206A_202D_200E_206B_206E_206B_202B_206C_202B_206B_200E_206B_202A_206F_206C_202E(x.Command, '/');
case 0:
goto IL_005d;
}
continue;
IL_005d:
num = 1902035637;
}
}
internal EEmote _003C_002Ector_003Eb__3_4((uint RowId, string Command) x)
{
return (EEmote)x.RowId;
}
internal string _003C_002Ector_003Eb__3_5((uint RowId, string Command) x)
{
return x.Command;
}
static bool _200E_206A_206F_202E_206D_206E_206F_202B_202B_206A_200D_206B_202B_200D_206D_200C_202B_200E_202B_200C_200C_206F_202D_206C_200D_206D_202C_206B_202E_206D_200C_202D_202B_206B_200C_206F_202B_202D_206B_202D_202E(string P_0)
{
return string.IsNullOrEmpty(P_0);
}
static bool _206E_202D_200C_202C_202E_200D_206C_202A_202D_206C_206A_202B_206D_202E_202B_200F_206F_206D_206F_206F_200D_206A_202E_202A_206A_206A_202D_200E_206B_206E_206B_202B_206C_202B_206B_200E_206B_202A_206F_206C_202E(string P_0, char P_1)
{
return P_0.StartsWith(P_1);
}
}
private readonly ReadOnlyDictionary<EEmote, string> _emoteCommands;
private readonly GameFunctions _gameFunctions;
private readonly ITargetManager _targetManager;
public ChatFunctions(IDataManager dataManager, GameFunctions gameFunctions, ITargetManager targetManager)
{
_gameFunctions = gameFunctions;
_targetManager = targetManager;
_emoteCommands = (from x in dataManager.GetExcelSheet<Emote>()
where x.RowId != 0
where x.TextCommand.IsValid
select (RowId: x.RowId, Command: x.TextCommand.Value.Command.ToString())).Where<(uint, string)>(delegate((uint RowId, string Command) x)
{
int num = (_003C_003Ec._200E_206A_206F_202E_206D_206E_206F_202B_202B_206A_200D_206B_202B_200D_206D_200C_202B_200E_202B_200C_200C_206F_202D_206C_200D_206D_202C_206B_202E_206D_200C_202D_202B_206B_200C_206F_202B_202D_206B_202D_202E(x.Command) ? 1902035638 : 1902035637);
while (true)
{
int num2 = num;
int num3 = 1902035639;
int num4 = num2;
int num5 = num4 + num3;
int num6 = num4 & num3;
switch (num5 - (num6 + num6))
{
case 1:
return false;
case 2:
return _003C_003Ec._206E_202D_200C_202C_202E_200D_206C_202A_202D_206C_206A_202B_206D_202E_202B_200F_206F_206D_206F_206F_200D_206A_202E_202A_206A_206A_202D_200E_206B_206E_206B_202B_206C_202B_206B_200E_206B_202A_206F_206C_202E(x.Command, '/');
case 0:
goto IL_005d;
}
continue;
IL_005d:
num = 1902035637;
}
}).ToDictionary<(uint, string), EEmote, string>(((uint RowId, string Command) x) => (EEmote)x.RowId, ((uint RowId, string Command) x) => x.Command).AsReadOnly();
}
public static void ExecuteCommand(string command)
{
int num = (_202D_202B_202A_202C_200E_206F_200C_206F_200B_202E_202C_200F_202A_200D_206C_202B_200B_206A_206B_200D_202A_206E_202A_202C_202B_206D_202B_202B_200D_206A_206D_202D_202D_206D_200F_200B_202D_202D_200B_202D_202E(command, '/') ? 1153841809 : 1153841810);
while (true)
{
int num2 = num;
int num3 = 1153841811;
int num4 = num2;
int num5 = num4 + num3;
int num6 = num4 & num3;
switch (num5 - (num6 + num6))
{
case 2:
_200F_202B_200B_202A_202E_206A_202C_202B_206A_200E_202B_200C_200F_200D_206C_202B_206C_202B_206A_200B_202E_206C_200C_202E_206D_200B_200E_206C_206E_202A_206B_206F_200E_206A_202E_206C_206C_206C_202D_200C_202E(command);
return;
case 1:
return;
case 0:
goto IL_0052;
}
continue;
IL_0052:
num = 1153841810;
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
public bool UseEmote(uint dataId, EEmote emote)
{
IGameObject gameObject = _gameFunctions.FindObjectByDataId(dataId);
int num = ((gameObject == null) ? (-888767094) : (-888767093));
while (true)
{
int num2 = num;
int num3 = -888767094;
int num4 = num2;
switch ((num4 | num3) - (num4 & num3))
{
case 2:
goto IL_005b;
case 1:
_202A_200D_202E_206A_202D_200E_202D_202B_206F_200F_202C_200B_200D_200E_202A_200B_206A_206F_200E_202C_206C_206E_206F_202A_202A_206E_200F_202A_200D_200F_206C_202A_206D_206F_200F_200B_202B_206B_200E_200F_202E(_targetManager, gameObject);
ExecuteCommand(_206D_206D_200D_206B_202D_200F_202C_206F_206B_206B_200D_206B_206E_202D_202A_206E_206E_206B_200D_206F_202C_206B_202B_200F_202C_206C_202A_206C_202B_200F_206B_202A_202D_200F_206F_202C_206C_200F_206A_206A_202E(_emoteCommands[emote], global::_003CModule_003E._202A_206B_206D_200C_206B_200E_200E_202A_200B_202E_206A_206F_206A_206B_200E_200D_200F_206D_206E_206A_206F_200C_206C_202C_202A_206E_202C_200B_206E_202A_206E_202B_206B_202E_202E_206A_206D_206D_202C_200F_202E<string>(-1428224074)));
return true;
case 0:
return false;
}
continue;
IL_005b:
num = -888767093;
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
public void UseEmote(EEmote emote)
{
ExecuteCommand(_206D_206D_200D_206B_202D_200F_202C_206F_206B_206B_200D_206B_206E_202D_202A_206E_206E_206B_200D_206F_202C_206B_202B_200F_202C_206C_202A_206C_202B_200F_206B_202A_202D_200F_206F_202C_206C_200F_206A_206A_202E(_emoteCommands[emote], global::_003CModule_003E._202A_206B_206D_200C_206B_200E_200E_202A_200B_202E_206A_206F_206A_206B_200E_200D_200F_206D_206E_206A_206F_200C_206C_202C_202A_206E_202C_200B_206E_202A_206E_202B_206B_202E_202E_206A_206D_206D_202C_200F_202E<string>(-1428224074)));
}
static bool _202D_202B_202A_202C_200E_206F_200C_206F_200B_202E_202C_200F_202A_200D_206C_202B_200B_206A_206B_200D_202A_206E_202A_202C_202B_206D_202B_202B_200D_206A_206D_202D_202D_206D_200F_200B_202D_202D_200B_202D_202E(string P_0, char P_1)
{
return P_0.StartsWith(P_1);
}
static void _200F_202B_200B_202A_202E_206A_202C_202B_206A_200E_202B_200C_200F_200D_206C_202B_206C_202B_206A_200B_202E_206C_200C_202E_206D_200B_200E_206C_206E_202A_206B_206F_200E_206A_202E_206C_206C_206C_202D_200C_202E(string P_0)
{
ChatHelper.SendCommand(P_0);
}
static void _202A_200D_202E_206A_202D_200E_202D_202B_206F_200F_202C_200B_200D_200E_202A_200B_206A_206F_200E_202C_206C_206E_206F_202A_202A_206E_200F_202A_200D_200F_206C_202A_206D_206F_200F_200B_202B_206B_200E_200F_202E(ITargetManager P_0, IGameObject P_1)
{
P_0.Target = P_1;
}
static string _206D_206D_200D_206B_202D_200F_202C_206F_206B_206B_200D_206B_206E_202D_202A_206E_206E_206B_200D_206F_202C_206B_202B_200F_202C_206C_202A_206C_202B_200F_206B_202A_202D_200F_206F_202C_206C_200F_206A_206A_202E(string P_0, string P_1)
{
return P_0 + P_1;
}
}