mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
More 5.1 fixes or maybe not who knows
This commit is contained in:
parent
dfec31d89c
commit
799f5ef634
10 changed files with 169 additions and 25 deletions
|
|
@ -88,7 +88,8 @@ namespace Dalamud {
|
|||
|
||||
this.BotManager.Start();
|
||||
|
||||
this.IconReplacer.Enable();
|
||||
if (this.Configuration.ComboPresets != CustomComboPreset.None)
|
||||
this.IconReplacer.Enable();
|
||||
}
|
||||
|
||||
public void Unload() {
|
||||
|
|
@ -106,7 +107,8 @@ namespace Dalamud {
|
|||
|
||||
this.unloadSignal.Dispose();
|
||||
|
||||
this.IconReplacer.Dispose();
|
||||
if (this.Configuration.ComboPresets != CustomComboPreset.None)
|
||||
this.IconReplacer.Dispose();
|
||||
}
|
||||
|
||||
private void SetupCommands() {
|
||||
|
|
@ -346,7 +348,6 @@ namespace Dalamud {
|
|||
var argumentsParts = arguments.Split();
|
||||
|
||||
switch (argumentsParts[0]) {
|
||||
/* Sorry!
|
||||
case "setall": {
|
||||
foreach (var value in Enum.GetValues(typeof(CustomComboPreset)).Cast<CustomComboPreset>()) {
|
||||
if (value == CustomComboPreset.None)
|
||||
|
|
@ -394,7 +395,7 @@ namespace Dalamud {
|
|||
}
|
||||
}
|
||||
break;
|
||||
*/
|
||||
|
||||
case "list": {
|
||||
foreach (var value in Enum.GetValues(typeof(CustomComboPreset)).Cast<CustomComboPreset>()) {
|
||||
if (this.Configuration.ComboPresets.HasFlag(value))
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup Label="Target">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<TargetFramework>net471</TargetFramework>
|
||||
|
|
@ -14,9 +14,9 @@
|
|||
</PropertyGroup>
|
||||
<PropertyGroup Label="Feature">
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<AssemblyVersion>2.2.0.0</AssemblyVersion>
|
||||
<Version>2.2.0</Version>
|
||||
<FileVersion>2.2.0.0</FileVersion>
|
||||
<AssemblyVersion>2.4.0.0</AssemblyVersion>
|
||||
<Version>2.4.0</Version>
|
||||
<FileVersion>2.4.0.0</FileVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="Resources">
|
||||
<None Include="$(SolutionDir)/Resources/**/*" CopyToOutputDirectory="PreserveNewest" Visible="false" />
|
||||
|
|
|
|||
|
|
@ -32,12 +32,12 @@ namespace Dalamud.Game.ClientState.Actors {
|
|||
if (index > Length)
|
||||
return null;
|
||||
|
||||
Log.Information("Trying to get actor at {0}", index);
|
||||
//Log.Information("Trying to get actor at {0}", index);
|
||||
var tblIndex = Address.ActorTable + 8 + index * 8;
|
||||
|
||||
var offset = Marshal.ReadIntPtr(tblIndex);
|
||||
|
||||
Log.Information("Actor at {0}", offset.ToString());
|
||||
//Log.Information("Actor at {0}", offset.ToString());
|
||||
|
||||
if (offset == IntPtr.Zero)
|
||||
throw new Exception($"Actor slot at index {index} is invalid");
|
||||
|
|
|
|||
|
|
@ -32,7 +32,8 @@ namespace Dalamud.Game.ClientState
|
|||
/// <summary>
|
||||
/// The local player character, if one is present.
|
||||
/// </summary>
|
||||
public PlayerCharacter LocalPlayer { get; private set; }
|
||||
//public PlayerCharacter LocalPlayer { get; private set; }
|
||||
public PlayerCharacter LocalPlayer => (PlayerCharacter) this.Actors[0];
|
||||
|
||||
/// <summary>
|
||||
/// The content ID of the local character.
|
||||
|
|
@ -67,8 +68,7 @@ namespace Dalamud.Game.ClientState
|
|||
}
|
||||
|
||||
private void FrameworkOnOnUpdateEvent(Framework framework) {
|
||||
LocalPlayer = (PlayerCharacter) this.Actors[0];
|
||||
Log.Verbose("FRAMEWORK UPDATE");
|
||||
//LocalPlayer = (PlayerCharacter) this.Actors[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
using Dalamud.Game.Network.Structures;
|
||||
|
||||
namespace Dalamud.Game.Network.MarketBoardUploaders {
|
||||
internal interface IMarketBoardUploader {
|
||||
void Upload(MarketBoardItemRequest itemRequest);
|
||||
void UploadTax(MarketTaxRates taxRates);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Net;
|
||||
using Dalamud.Game.Network.MarketBoardUploaders;
|
||||
using Dalamud.Game.Network.MarketBoardUploaders.Universalis;
|
||||
using Dalamud.Game.Network.Structures;
|
||||
using Newtonsoft.Json;
|
||||
using Serilog;
|
||||
|
||||
|
|
@ -86,5 +87,31 @@ namespace Dalamud.Game.Network.Universalis.MarketBoardUploaders {
|
|||
Log.Verbose("Universalis data upload for item#{0} completed.", request.CatalogId);
|
||||
}
|
||||
}
|
||||
|
||||
public void UploadTax(MarketTaxRates taxRates) {
|
||||
using (var client = new WebClient())
|
||||
{
|
||||
var taxRatesRequest = new UniversalisTaxUploadRequest();
|
||||
taxRatesRequest.WorldId = this.dalamud.ClientState.LocalPlayer.CurrentWorld.Id;
|
||||
taxRatesRequest.UploaderId = this.dalamud.ClientState.LocalContentId;
|
||||
|
||||
taxRatesRequest.TaxData = new UniversalisTaxData {
|
||||
LimsaLominsa = taxRates.LimsaLominsaTax,
|
||||
Gridania = taxRates.GridaniaTax,
|
||||
Uldah = taxRates.UldahTax,
|
||||
Ishgard = taxRates.IshgardTax,
|
||||
Kugane = taxRates.KuganeTax,
|
||||
Crystarium = taxRates.CrystariumTax
|
||||
};
|
||||
|
||||
client.Headers.Add(HttpRequestHeader.ContentType, "application/json");
|
||||
|
||||
var historyUpload = JsonConvert.SerializeObject(taxRatesRequest);
|
||||
client.UploadString(ApiBase + $"/upload/{ApiKey}", "POST", historyUpload);
|
||||
Log.Verbose(historyUpload);
|
||||
|
||||
Log.Verbose("Universalis tax upload completed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,41 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Dalamud.Game.Network.MarketBoardUploaders.Universalis
|
||||
{
|
||||
class UniversalisTaxUploadRequest
|
||||
{
|
||||
[JsonProperty("uploaderID")]
|
||||
public ulong UploaderId { get; set; }
|
||||
|
||||
[JsonProperty("worldID")]
|
||||
public int WorldId { get; set; }
|
||||
|
||||
[JsonProperty("marketTaxRates")]
|
||||
public UniversalisTaxData TaxData { get; set; }
|
||||
}
|
||||
|
||||
class UniversalisTaxData {
|
||||
[JsonProperty("limsaLominsa")]
|
||||
public uint LimsaLominsa { get; set; }
|
||||
|
||||
[JsonProperty("gridania")]
|
||||
public uint Gridania { get; set; }
|
||||
|
||||
[JsonProperty("uldah")]
|
||||
public uint Uldah { get; set; }
|
||||
|
||||
[JsonProperty("ishgard")]
|
||||
public uint Ishgard { get; set; }
|
||||
|
||||
[JsonProperty("kugane")]
|
||||
public uint Kugane { get; set; }
|
||||
|
||||
[JsonProperty("crystarium")]
|
||||
public uint Crystarium { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -29,6 +29,7 @@ namespace Dalamud.Game.Network {
|
|||
private void OnZonePacket(IntPtr dataPtr) {
|
||||
var opCode = (ZoneOpCode) Marshal.ReadInt16(dataPtr, 2);
|
||||
|
||||
/*
|
||||
if (opCode == ZoneOpCode.RetainerSaleItemId) {
|
||||
var itemId = Marshal.ReadInt32(dataPtr + 16);
|
||||
var amount = Marshal.ReadByte(dataPtr + 32);
|
||||
|
|
@ -58,22 +59,25 @@ namespace Dalamud.Game.Network {
|
|||
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
if (opCode == ZoneOpCode.CfNotify) {
|
||||
if (opCode == ZoneOpCode.CfNotifyRoulette) {
|
||||
var data = new byte[64];
|
||||
Marshal.Copy(dataPtr, data, 0, 64);
|
||||
|
||||
var notifyType = data[16];
|
||||
var contentFinderConditionId = BitConverter.ToInt16(data, 28);
|
||||
var contentFinderConditionId = BitConverter.ToInt16(data, 36);
|
||||
|
||||
|
||||
Task.Run(async () => {
|
||||
if (notifyType != 2 || contentFinderConditionId == 0)
|
||||
if (notifyType != 3 || contentFinderConditionId == 0)
|
||||
return;
|
||||
|
||||
var contentFinderCondition =
|
||||
await XivApi.GetContentFinderCondition(contentFinderConditionId);
|
||||
|
||||
this.dalamud.Framework.Gui.Chat.Print($"Duty pop: " + contentFinderCondition["Name"]);
|
||||
|
||||
if (this.dalamud.BotManager.IsConnected)
|
||||
await this.dalamud.BotManager.ProcessCfPop(contentFinderCondition);
|
||||
});
|
||||
|
|
@ -173,14 +177,32 @@ namespace Dalamud.Game.Network {
|
|||
|
||||
Log.Verbose("Added history for item#{0}", listing.CatalogId);
|
||||
}
|
||||
|
||||
if (opCode == ZoneOpCode.MarketTaxRates)
|
||||
{
|
||||
var taxes = MarketTaxRates.Read(dataPtr + 0x10);
|
||||
|
||||
Log.Verbose("MarketTaxRates: limsa#{0} grid#{1} uldah#{2} ish#{3} kugane#{4} cr#{5}",
|
||||
taxes.LimsaLominsaTax, taxes.GridaniaTax, taxes.UldahTax, taxes.IshgardTax, taxes.KuganeTax, taxes.CrystariumTax);
|
||||
try
|
||||
{
|
||||
Task.Run(() => this.uploader.UploadTax(taxes));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex, "Market Board data upload failed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private enum ZoneOpCode {
|
||||
CfNotifyRoulette = 0xB3,
|
||||
CfNotify = 0x8F,
|
||||
RetainerSaleItemId = 0x13F, // TODO these are probably not accurate
|
||||
RetainerSaleFinish = 0x138,
|
||||
FateSpawn = 0x226,
|
||||
MarketTaxRates = 0x76,
|
||||
MarketBoardItemRequestStart = 0x39D,
|
||||
MarketBoardOfferings = 0x36A,
|
||||
MarketBoardHistory = 0x194
|
||||
|
|
|
|||
|
|
@ -3,22 +3,28 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace Dalamud.Game.Network.Structures {
|
||||
public class MarketBoardCurrentOfferings {
|
||||
namespace Dalamud.Game.Network.Structures
|
||||
{
|
||||
public class MarketBoardCurrentOfferings
|
||||
{
|
||||
public List<MarketBoardItemListing> ItemListings;
|
||||
|
||||
public int ListingIndexEnd;
|
||||
public int ListingIndexStart;
|
||||
public int RequestId;
|
||||
|
||||
public static unsafe MarketBoardCurrentOfferings Read(IntPtr dataPtr) {
|
||||
public static unsafe MarketBoardCurrentOfferings Read(IntPtr dataPtr)
|
||||
{
|
||||
var output = new MarketBoardCurrentOfferings();
|
||||
|
||||
using (var stream = new UnmanagedMemoryStream((byte*) dataPtr.ToPointer(), 1544)) {
|
||||
using (var reader = new BinaryReader(stream)) {
|
||||
using (var stream = new UnmanagedMemoryStream((byte*)dataPtr.ToPointer(), 1544))
|
||||
{
|
||||
using (var reader = new BinaryReader(stream))
|
||||
{
|
||||
output.ItemListings = new List<MarketBoardItemListing>();
|
||||
|
||||
for (var i = 0; i < 10; i++) {
|
||||
for (var i = 0; i < 10; i++)
|
||||
{
|
||||
var listingEntry = new MarketBoardItemListing();
|
||||
|
||||
listingEntry.ListingId = reader.ReadUInt64();
|
||||
|
|
@ -38,7 +44,8 @@ namespace Dalamud.Game.Network.Structures {
|
|||
|
||||
listingEntry.Materia = new List<MarketBoardItemListing.ItemMateria>();
|
||||
|
||||
for (var materiaIndex = 0; materiaIndex < 5; materiaIndex++) {
|
||||
for (var materiaIndex = 0; materiaIndex < 5; materiaIndex++)
|
||||
{
|
||||
var materiaVal = reader.ReadUInt16();
|
||||
|
||||
var materiaEntry = new MarketBoardItemListing.ItemMateria();
|
||||
|
|
@ -76,7 +83,8 @@ namespace Dalamud.Game.Network.Structures {
|
|||
return output;
|
||||
}
|
||||
|
||||
public class MarketBoardItemListing {
|
||||
public class MarketBoardItemListing
|
||||
{
|
||||
public ulong ArtisanId;
|
||||
public uint CatalogId;
|
||||
public bool IsHq;
|
||||
|
|
@ -97,7 +105,8 @@ namespace Dalamud.Game.Network.Structures {
|
|||
public int StainId;
|
||||
public uint TotalTax;
|
||||
|
||||
public class ItemMateria {
|
||||
public class ItemMateria
|
||||
{
|
||||
public int Index;
|
||||
public int MateriaId;
|
||||
}
|
||||
|
|
|
|||
41
Dalamud/Game/Network/Structures/MarketTaxRate.cs
Normal file
41
Dalamud/Game/Network/Structures/MarketTaxRate.cs
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace Dalamud.Game.Network.Structures
|
||||
{
|
||||
public class MarketTaxRates
|
||||
{
|
||||
public uint LimsaLominsaTax;
|
||||
public uint GridaniaTax;
|
||||
public uint UldahTax;
|
||||
public uint IshgardTax;
|
||||
public uint KuganeTax;
|
||||
public uint CrystariumTax;
|
||||
|
||||
|
||||
public static unsafe MarketTaxRates Read(IntPtr dataPtr)
|
||||
{
|
||||
var output = new MarketTaxRates();
|
||||
|
||||
using (var stream = new UnmanagedMemoryStream((byte*)dataPtr.ToPointer(), 1544))
|
||||
{
|
||||
using (var reader = new BinaryReader(stream))
|
||||
{
|
||||
stream.Position += 8;
|
||||
|
||||
output.LimsaLominsaTax = reader.ReadUInt32();
|
||||
output.GridaniaTax = reader.ReadUInt32();
|
||||
output.UldahTax = reader.ReadUInt32();
|
||||
output.IshgardTax = reader.ReadUInt32();
|
||||
output.KuganeTax = reader.ReadUInt32();
|
||||
output.CrystariumTax = reader.ReadUInt32();
|
||||
}
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue