private void OnBgmSetCommand(string command, string arguments)
{
this.Framework.Network.InjectBgmTest(int.Parse(arguments));
}
this.CommandManager.AddHandler("/xlbgmset", new CommandInfo(new CommandInfo.HandlerDelegate(this.OnBgmSetCommand))
{
HelpMessage = "Set the Game background music. Usage: /bgmset <BGM ID>"
});
using Dalamud;
using Dalamud.Game;
using Dalamud.Game.Internal;
using Dalamud.Hooking;
using Serilog;
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace Dalamud.Game.Internal.Network
{
public sealed class GameNetwork : IDisposable
{
private readonly Hook<GameNetwork.ProcessZonePacketDelegate> processZonePacketHook;
private IntPtr baseAddress;
public GameNetwork.OnZonePacketDelegate OnZonePacket;
private readonly Dalamud dalamud;
private readonly Queue<byte[]> zoneInjectQueue = new Queue<byte[]>();
private GameNetworkAddressResolver Address
{
get;
}
public GameNetwork(Dalamud dalamud, SigScanner scanner)
{
this.dalamud = dalamud;
this.Address = new GameNetworkAddressResolver();
this.Address.Setup(scanner);
Log.Verbose<IntPtr>("ProcessZonePacket address {ProcessZonePacket}", this.Address.ProcessZonePacket);
this.processZonePacketHook = new Hook<GameNetwork.ProcessZonePacketDelegate>(this.Address.ProcessZonePacket, new GameNetwork.ProcessZonePacketDelegate(this.ProcessZonePacketDetour), this);
}
public void Dispose()
{
this.processZonePacketHook.Dispose();
}
public void Enable()
{
this.processZonePacketHook.Enable();
}
private void InjectActorControl(short cat, int param1)
{
byte[] numArray = new byte[] { 20, 0, 100, 1, 0, 0, 14, 0, 23, 124, 197, 93, 0, 0, 0, 0, 5, 0, 72, 178, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67, 127, 0, 0 };
BitConverter.GetBytes(cat).CopyTo(numArray, 16);
BitConverter.GetBytes((uint)param1).CopyTo(numArray, 20);
this.InjectZoneProtoPacket(numArray);
}
public void InjectBgmTest(int key)
{
this.InjectActorControl(161, key);
}
private void InjectZoneProtoPacket(byte[] data)
{
this.zoneInjectQueue.Enqueue(data);
}
private void ProcessZonePacketDetour(IntPtr a, IntPtr b, IntPtr dataPtr)
{
string str;
this.baseAddress = a;
GameNetwork.OnZonePacketDelegate onZonePacket = this.OnZonePacket;
if (onZonePacket != null)
{
onZonePacket(dataPtr);
}
else
{
}
try
{
this.processZonePacketHook.Original(a, b, dataPtr);
}
catch (Exception exception2)
{
Exception exception = exception2;
try
{
byte[] numArray = new byte[32];
Marshal.Copy(dataPtr, numArray, 0, 32);
str = BitConverter.ToString(numArray);
}
catch (Exception exception1)
{
str = "failed";
}
Log.Error(exception, string.Concat("Exception on ProcessZonePacket hook. Header: ", str));
this.processZonePacketHook.Original(a, b, dataPtr);
}
}
/// <summary>
/// Process a chat queue.
/// </summary>
public void UpdateQueue(Framework framework)
{
while (this.zoneInjectQueue.Count > 0)
{
byte[] numArray = this.zoneInjectQueue.Dequeue();
IntPtr intPtr = Marshal.AllocHGlobal((int)numArray.Length);
Marshal.Copy(numArray, 0, intPtr, (int)numArray.Length);
if (this.baseAddress != IntPtr.Zero)
{
this.processZonePacketHook.Original(this.baseAddress, IntPtr.Zero, intPtr);
}
Marshal.FreeHGlobal(intPtr);
}
}
public delegate void OnZonePacketDelegate(IntPtr dataPtr);
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
private delegate void ProcessZonePacketDelegate(IntPtr a, IntPtr b, IntPtr dataPtr);
}
}
Great to hear, and I figured it was a long shot.Loot window is on my to do list. RB doesn't have any features for packets at all.
[00:33:42.466 V] [Poi.Clear] Reason: Current behavior changed to FlyTo: LineNumber: 12, XYZ: <-627.996, 17.9868, 182.262>, Name: null, AllowedVariance: 0, ArrivalTolerance: 0.5, MinHeight: 0, Hotspots: null, Land: True, Dismount: False, IgnoreIndoors: False, IsDone: False, HighPriority: False, InCombat: False, QuestId: 0, StepId: 0, PostCombatDelay: 0, QuestName: null, IsDoneCache: False, Behavior: null, .
[00:33:42.466 D] Replaced hook [ProfileOrderBehavior_Hook] b42fdbb9-d491-4e02-aa44-2bcf03c442f9
[00:33:42.467 D] [Flightor] Set up for movement from <-627.6014, 25.97916, 283.7112> to <-627.996, 17.9868, 182.262>
[00:33:42.955 Q] Disconnected from nav server
[00:33:45.247 Q] Reconnected to nav server
[00:33:46.298 Q] Disconnected from nav server
[00:33:48.584 Q] Reconnected to nav server
Do you know why the nav server decides to disconnect instead of either returning a path or saying it can't navigate there? I've heard other complain about just getting nav disconnect but this was the first time i found a repeatable example. I'm working on generating Sightseeing log profiles and some if it can't get there it just throw an exception, this one it starts flying and then you get just get disconnected from nav repeatably. I had someone else run it with the same result.
....to infinity while the character just flys off in a straight line
Here's one in heavensward that does the same in case you can't test in shb zone
<TeleportTo AetheryteId="76"/>
<FlyTo ZoneId="398" XYZ="-298.218, 406.622, 40.5729" Name="Anyx Trine" ArrivalTolerance="0.5" Land="true" AllowedVariance="0.0"/>
Saddlebag_Page1 = 4000,
Saddlebag_Page2 = 4001,
PremiumSaddlebag_Page1 = 4100,
PremiumSaddlebag_Page2 = 4101
In the next update or so do think you could add the Chocobo bags to the InventoryBagId enum? they are:
I'm not sure how you want to name them, it's not important.Code:Saddlebag_Page1 = 4000, Saddlebag_Page2 = 4001, PremiumSaddlebag_Page1 = 4100, PremiumSaddlebag_Page2 = 4101
Additions:
Spell.Image added, returns image for a given spell.
More paths added to GetTo
Bug Fixes:
Vector3.Raycast will now return the correct value
Corrected issues with antistuck logic not checking the correct direction
Fix descending while swimming
GreyMagic.PatternFinder patternFinder = new GreyMagic.PatternFinder(Core.Memory);
IntPtr ptr = patternFinder.Find("Search 48 8D 05 ? ? ? ? 48 89 03 B9 ? ? ? ? 4C 89 43 ? Add 3 TraceRelative ") ;
int AgentId = ff14bot.Managers.AgentModule.FindAgentIdByVtable(ptr);
IntPtr addr = patternFinder.Find("Search 48 89 5C 24 ? 57 48 83 EC ? 88 51 ? 49 8B F9");
Core.Memory.CallInjected64<IntPtr>(addr, AgentModule.GetAgentInterfaceById(AgentId).Pointer, 6, 0, 0);
Thanks for the raycast and antistuck fixes. I noticed your Repair remote window does not have an open and the agent interface toggle doesn't open it (agent 36) so in case you were interested this will toggle the window (open if it's closed and close if it's open). Everything is as generic/pattern matching as i could. Just figured i'd pass it along, I made a self repair orderbot tag with it though i can't check the patterns against the CN client.
Code:GreyMagic.PatternFinder patternFinder = new GreyMagic.PatternFinder(Core.Memory); IntPtr ptr = patternFinder.Find("Search 48 8D 05 ? ? ? ? 48 89 03 B9 ? ? ? ? 4C 89 43 ? Add 3 TraceRelative ") ; int AgentId = ff14bot.Managers.AgentModule.FindAgentIdByVtable(ptr); IntPtr addr = patternFinder.Find("Search 48 89 5C 24 ? 57 48 83 EC ? 88 51 ? 49 8B F9"); Core.Memory.CallInjected64<IntPtr>(addr, AgentModule.GetAgentInterfaceById(AgentId).Pointer, 6, 0, 0);
Use a custom protobuff serializer. This will prevent 3rd party addons that also use protobuff (lisbeth) from corrupting network messages.
Resolves issue with orderbot randomly failing due to "Type 1 unsupported path type" errors