mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
5.1 fixed, minimal chat mode
This commit is contained in:
parent
ba5fa1f4d0
commit
b857506fd6
8 changed files with 90 additions and 61 deletions
|
|
@ -14,10 +14,10 @@
|
|||
</PropertyGroup>
|
||||
<PropertyGroup Label="Feature">
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<AssemblyVersion>2.9.0.0</AssemblyVersion>
|
||||
<FileVersion>2.9.0.0</FileVersion>
|
||||
<AssemblyVersion>3.1.0.0</AssemblyVersion>
|
||||
<FileVersion>3.1.0.0</FileVersion>
|
||||
<Description>XIVLauncher addon injection</Description>
|
||||
<Version>2.9.0</Version>
|
||||
<Version>3.1.0</Version>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="EasyHook" Version="2.7.6270" />
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@
|
|||
</PropertyGroup>
|
||||
<PropertyGroup Label="Feature">
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<AssemblyVersion>2.7.0.0</AssemblyVersion>
|
||||
<Version>2.7.0</Version>
|
||||
<FileVersion>2.7.0.0</FileVersion>
|
||||
<AssemblyVersion>2.9.0.0</AssemblyVersion>
|
||||
<Version>2.9.0</Version>
|
||||
<FileVersion>2.9.0.0</FileVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="Resources">
|
||||
<None Include="$(SolutionDir)/Resources/**/*" CopyToOutputDirectory="PreserveNewest" Visible="false" />
|
||||
|
|
|
|||
|
|
@ -260,30 +260,39 @@ namespace Dalamud.DiscordBot {
|
|||
var avatarUrl = "";
|
||||
var lodestoneId = 0;
|
||||
|
||||
try {
|
||||
if (!this.config.DisableEmbeds) {
|
||||
try
|
||||
{
|
||||
dynamic charCandidates = await XivApi.GetCharacterSearch(sender, world);
|
||||
|
||||
if (charCandidates.Results.Count > 0) {
|
||||
if (charCandidates.Results.Count > 0)
|
||||
{
|
||||
avatarUrl = charCandidates.Results[0].Avatar;
|
||||
lodestoneId = charCandidates.Results[0].ID;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex, "Could not get XIVAPI character search result.");
|
||||
}
|
||||
}
|
||||
|
||||
Thread.Sleep(this.config.ChatDelayMs);
|
||||
|
||||
var name = wasOutgoingTell
|
||||
? "You"
|
||||
: sender + (string.IsNullOrEmpty(world) || string.IsNullOrEmpty(sender)
|
||||
? ""
|
||||
: $" on {world}");
|
||||
|
||||
for (var chatTypeIndex = 0; chatTypeIndex < chatTypeConfigs.Count(); chatTypeIndex++) {
|
||||
if (!this.config.DisableEmbeds) {
|
||||
var embedBuilder = new EmbedBuilder
|
||||
{
|
||||
Author = new EmbedAuthorBuilder
|
||||
{
|
||||
IconUrl = avatarUrl,
|
||||
Name = wasOutgoingTell
|
||||
? "You"
|
||||
: sender + (string.IsNullOrEmpty(world) || string.IsNullOrEmpty(sender)
|
||||
? ""
|
||||
: $" on {world}"),
|
||||
Name = name,
|
||||
Url = lodestoneId != 0 ? "https://eu.finalfantasyxiv.com/lodestone/character/" + lodestoneId : null
|
||||
},
|
||||
Description = message,
|
||||
|
|
@ -316,6 +325,23 @@ namespace Dalamud.DiscordBot {
|
|||
}
|
||||
|
||||
await channels.ElementAt(chatTypeIndex).SendMessageAsync(embed: embedBuilder.Build());
|
||||
} else {
|
||||
var simpleMessage = $"{name}: {message}";
|
||||
|
||||
if (this.config.CheckForDuplicateMessages) {
|
||||
var recentMsg = this.recentMessages.FirstOrDefault(
|
||||
msg => msg.Content == simpleMessage);
|
||||
|
||||
if (recentMsg != null)
|
||||
{
|
||||
Log.Verbose("Duplicate message: {0}", simpleMessage);
|
||||
this.recentMessages.Remove(recentMsg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
await channels.ElementAt(chatTypeIndex).SendMessageAsync($"{name}: {message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,11 +32,14 @@ namespace Dalamud.DiscordBot
|
|||
public class DiscordFeatureConfiguration
|
||||
{
|
||||
public string Token { get; set; }
|
||||
public ulong OwnerUserId { get; set; }
|
||||
|
||||
public bool CheckForDuplicateMessages { get; set; }
|
||||
public int ChatDelayMs { get; set; }
|
||||
|
||||
public bool DisableEmbeds { get; set; }
|
||||
|
||||
public ulong OwnerUserId { get; set; }
|
||||
|
||||
public List<ChatTypeConfiguration> ChatTypeConfigurations { get; set; }
|
||||
|
||||
public ChannelConfiguration CfNotificationChannel { get; set; }
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ namespace Dalamud.Game.ClientState
|
|||
public IntPtr JobGaugeData { get; set; }
|
||||
|
||||
protected override void Setup64Bit(SigScanner sig) {
|
||||
ActorTable = sig.Module.BaseAddress + 0x1C01D90;
|
||||
ActorTable = sig.Module.BaseAddress + 0x1BFBA38;
|
||||
LocalContentId = sig.Module.BaseAddress + 0x1C2E000;
|
||||
JobGaugeData = sig.Module.BaseAddress + 0x1BFD110;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ namespace Dalamud.Game.Internal.Gui {
|
|||
//PopulateItemLinkObject = sig.ScanText("48 89 5C 24 08 57 48 83 EC 20 80 7A 06 00 48 8B DA 48 8B F9 74 14 48 8B CA E8 32 03 00 00 48 8B C8 E8 FA F2 B0 FF 8B C8 EB 1D 0F B6 42 14 8B 4A");
|
||||
|
||||
//PopulateItemLinkObject = sig.ScanText( "48 89 5C 24 08 57 48 83 EC 20 80 7A 06 00 48 8B DA 48 8B F9 74 14 48 8B CA E8 32 03 00 00 48 8B C8 E8 ?? ?? B0 FF 8B C8 EB 1D 0F B6 42 14 8B 4A"); 5.0
|
||||
PopulateItemLinkObject = sig.ScanText("48 89 5C 24 08 57 48 83 EC 20 80 7A 06 00 48 8B DA 48 8B F9 74 14 48 8B CA E8 32 03 00 00 48 8B C8 E8 7A 12 AF FF 8B C8 EB 1D 0F B6 42 14 8B 4A");
|
||||
PopulateItemLinkObject = sig.ScanText("48 89 5C 24 08 57 48 83 EC 20 80 7A 06 00 48 8B DA 48 8B F9 74 14 48 8B CA E8 32 03 00 00 48 8B C8 E8 ?? ?? ?? FF 8B C8 EB 1D 0F B6 42 14 8B 4A");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ namespace Dalamud.Game.Internal.Network {
|
|||
|
||||
private void InjectActorControl(short cat, int param1) {
|
||||
var packetData = new byte[] {
|
||||
0x14, 0x00, 0x64, 0x01, 0x00, 0x00, 0x0E, 0x00, 0x17, 0x7C, 0xC5, 0x5D, 0x00, 0x00, 0x00, 0x00,
|
||||
0x14, 0x00, 0x8D, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x17, 0x7C, 0xC5, 0x5D, 0x00, 0x00, 0x00, 0x00,
|
||||
0x05, 0x00, 0x48, 0xB2, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x43, 0x7F, 0x00, 0x00
|
||||
};
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ namespace Dalamud.Game.Network {
|
|||
}
|
||||
*/
|
||||
|
||||
if (opCode == ZoneOpCode.CfNotifyRoulette) {
|
||||
if (opCode == ZoneOpCode.CfNotifyPop) {
|
||||
var data = new byte[64];
|
||||
Marshal.Copy(dataPtr, data, 0, 64);
|
||||
|
||||
|
|
@ -197,15 +197,15 @@ namespace Dalamud.Game.Network {
|
|||
}
|
||||
|
||||
private enum ZoneOpCode {
|
||||
CfNotifyRoulette = 0xB3,
|
||||
CfNotifyPop = 0x32D,
|
||||
CfNotify = 0x8F,
|
||||
RetainerSaleItemId = 0x13F, // TODO these are probably not accurate
|
||||
RetainerSaleFinish = 0x138,
|
||||
FateSpawn = 0x226,
|
||||
MarketTaxRates = 0x76,
|
||||
MarketBoardItemRequestStart = 0x39D,
|
||||
MarketBoardOfferings = 0x36A,
|
||||
MarketBoardHistory = 0x194
|
||||
MarketTaxRates = 0x39F,
|
||||
MarketBoardItemRequestStart = 0xF2,
|
||||
MarketBoardOfferings = 0x1E2,
|
||||
MarketBoardHistory = 0x123
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue