Skip to content

Commit

Permalink
Merge branch 'violet1986-chn'
Browse files Browse the repository at this point in the history
  • Loading branch information
Icehunter committed Mar 4, 2015
2 parents 33e67f6 + 04ce7b3 commit 16afadb
Showing 1 changed file with 63 additions and 3 deletions.
66 changes: 63 additions & 3 deletions FFXIVAPP.Client/Memory/InventoryWorker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
using FFXIVAPP.Client.Properties;
using FFXIVAPP.Common.Core.Memory;
using FFXIVAPP.Common.Core.Memory.Enums;
using FFXIVAPP.Common.Core.Constant;
using Newtonsoft.Json;
using NLog;

Expand Down Expand Up @@ -92,7 +93,36 @@ public void StopScanning()
#region Threads

public Stopwatch Stopwatch = new Stopwatch();

// when CharacterName is not set in FFXIVAPP, get it from CHARMAP.
private void SetCharacterName()
{
if (Settings.Default.CharacterName.Length == 0)
{
var characterAddressMap = MemoryHandler.Instance.SigScanner.Locations["CHARMAP"];
uint characterAddress = MemoryHandler.Instance.GetUInt32(characterAddressMap);
String tempName = MemoryHandler.Instance.GetString(characterAddress, 0x30);
if (!tempName.Equals(Constants.CharacterName))
{
Constants.CharacterName = tempName;
ConstantsEntity lce = new ConstantsEntity
{
AutoTranslate = Constants.AutoTranslate,
CharacterName = Constants.CharacterName,
ChatCodes = Constants.ChatCodes,
ChatCodesXml = Constants.ChatCodesXml,
Colors = Constants.Colors,
CultureInfo = Constants.CultureInfo,
EnableHelpLabels = Constants.EnableHelpLabels,
GameLanguage = Constants.GameLanguage,
ServerName = Constants.ServerName,
Theme = Constants.Theme,
UIScale = Constants.UIScale
};
AppContextHelper.Instance.RaiseNewConstants(lce);
}
}

}
/// <summary>
/// </summary>
/// <param name="sender"> </param>
Expand Down Expand Up @@ -127,6 +157,20 @@ private void ScanTimerElapsed(object sender, ElapsedEventArgs e)
GetItems(InventoryPointerMap, Inventory.Container.EXTRA_EQ),
GetItems(InventoryPointerMap, Inventory.Container.CRYSTALS),
GetItems(InventoryPointerMap, Inventory.Container.QUESTS_KI),

GetItems(InventoryPointerMap, Inventory.Container.HIRE_1),
GetItems(InventoryPointerMap, Inventory.Container.HIRE_2),
GetItems(InventoryPointerMap, Inventory.Container.HIRE_3),
GetItems(InventoryPointerMap, Inventory.Container.HIRE_4),
GetItems(InventoryPointerMap, Inventory.Container.HIRE_5),
GetItems(InventoryPointerMap, Inventory.Container.HIRE_6),
GetItems(InventoryPointerMap, Inventory.Container.HIRE_7),

GetItems(InventoryPointerMap, Inventory.Container.COMPANY_1),
GetItems(InventoryPointerMap, Inventory.Container.COMPANY_2),
GetItems(InventoryPointerMap, Inventory.Container.COMPANY_3),
GetItems(InventoryPointerMap, Inventory.Container.COMPANY_CRYSTALS),

GetItems(InventoryPointerMap, Inventory.Container.AC_MH),
GetItems(InventoryPointerMap, Inventory.Container.AC_OH),
GetItems(InventoryPointerMap, Inventory.Container.AC_HEAD),
Expand Down Expand Up @@ -161,6 +205,7 @@ private void ScanTimerElapsed(object sender, ElapsedEventArgs e)
}
if (notify)
{
SetCharacterName();
AppContextHelper.Instance.RaiseNewInventoryEntries(inventoryEntities);
}
}
Expand All @@ -186,8 +231,21 @@ private InventoryEntity GetItems(uint address, Inventory.Container type)
Items = new List<ItemInfo>(),
Type = type
};
// The number of item is 50 in COMPANY's locker
int MAX_AMOUNT;
switch (type)
{
case Inventory.Container.COMPANY_1:
case Inventory.Container.COMPANY_2:
case Inventory.Container.COMPANY_3:
MAX_AMOUNT = 3200;
break;
default:
MAX_AMOUNT = 1600;
break;
}

for (var ci = 0; ci < 1600; ci += 64)
for (var ci = 0; ci < MAX_AMOUNT; ci += 64)
{
var itemOffset = (uint) (containerAddress + ci);
var id = MemoryHandler.Instance.GetUInt32(itemOffset, 0x8);
Expand All @@ -200,7 +258,9 @@ private InventoryEntity GetItems(uint address, Inventory.Container type)
Amount = MemoryHandler.Instance.GetByte(itemOffset, 0xC),
SB = MemoryHandler.Instance.GetUInt16(itemOffset, 0x10),
Durability = MemoryHandler.Instance.GetUInt16(itemOffset, 0x12),
GlamourID = MemoryHandler.Instance.GetUInt32(itemOffset, 0x30)
GlamourID = MemoryHandler.Instance.GetUInt32(itemOffset, 0x30),
//get the flag that show if the item is hq or not
IsHQ = (MemoryHandler.Instance.GetByte(itemOffset, 0x14) == 0x01)? true:false
});
}
}
Expand Down

0 comments on commit 16afadb

Please sign in to comment.