Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

Feat: Add support for MHW build 421631 #196

Merged
merged 1 commit into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 32 additions & 27 deletions HunterPie.Core/Core/Local/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,15 @@
using System.Linq;
using System.Threading;
using HunterPie.Core.Definitions;
using HunterPie.Core.Enums;
using HunterPie.Core.Events;
using HunterPie.Core.Jobs;
using HunterPie.Core.Local;
using HunterPie.Logger;
using HunterPie.Memory;
using HunterPie.Core.Local;
using HunterPie.Core.Events;
using Classes = HunterPie.Core.Enums.Classes;
using AbnormalityType = HunterPie.Core.Enums.AbnormalityType;
using HunterPie.Core.Enums;
using HunterPie.Utils;
using HunterPie.Native.Connection;
using HunterPie.Native.Connection.Packets;
using System.Threading.Tasks;
using AbnormalityType = HunterPie.Core.Enums.AbnormalityType;
using Classes = HunterPie.Core.Enums.Classes;

namespace HunterPie.Core
{
Expand Down Expand Up @@ -206,7 +203,7 @@ private set

if ((LastZoneID == -1 || harvestBoxZones.Contains(LastZoneID)) && !harvestBoxZones.Contains(zoneId))
Dispatch(OnVillageLeave, new PlayerLocationEventArgs(this));

if (!peaceZones.Contains(LastZoneID) && peaceZones.Contains(zoneId))
Dispatch(OnPeaceZoneEnter, new PlayerLocationEventArgs(this));

Expand Down Expand Up @@ -284,7 +281,7 @@ private set
/// Food data
/// </summary>
public sFoodData FoodData = new sFoodData();

/// <summary>
/// Player action id
/// </summary>
Expand Down Expand Up @@ -480,7 +477,8 @@ private void Dispatch(PlayerEvents e, EventArgs args)
try
{
del(this, args);
} catch (Exception err)
}
catch (Exception err)
{
Debugger.Error($"Error on callback \"{del.Method.Name}\": {err.Message}");
}
Expand Down Expand Up @@ -518,14 +516,15 @@ private void DispatchScanFinished()
try
{
sub(this, EventArgs.Empty);
} catch (Exception err)
}
catch (Exception err)
{
Debugger.Error($"Exception in {sub.Method.Name}: {err.Message}");
OnPlayerScanFinished -= sub;
}
}

}
}
#endregion

#region Scanner
Expand Down Expand Up @@ -831,7 +830,7 @@ private void GetPlayerInfo()

private void GetPlayerEffects()
{
long hotDrinkFlagAddress = Kernel.ReadMultilevelPtr(EQUIPMENT_ADDRESS + 0x920, new [] { 0x13D58, 0x8, 0xA24 });
long hotDrinkFlagAddress = Kernel.ReadMultilevelPtr(EQUIPMENT_ADDRESS + 0x920, new[] { 0x13D58, 0x8, 0xA24 });
bool hotDrinkFlag = Kernel.Read<byte>(hotDrinkFlagAddress) == 0;

HasHotDrink = hotDrinkFlag;
Expand Down Expand Up @@ -894,7 +893,7 @@ private void GetItemBox()
Array.Copy(itemBox, 200, ammo, 0, ammo.Length);
Array.Copy(itemBox, 400, materials, 0, materials.Length);
Array.Copy(itemBox, 1650, decorations, 0, decorations.Length);

ItemBox.Refresh(consumables, ammo, materials, decorations);
}

Expand Down Expand Up @@ -1029,8 +1028,8 @@ private void GetPlayerStamina(long address)
long cGuiStaminaAddress = Kernel.ReadMultilevelPtr(Address.GetAddress("BASE") + Address.GetAddress("HUD_DATA_OFFSET"), Address.GetOffsets("gHudStaminaBarOffsets"));

Stamina.Update(
maxStamina: Kernel.Read<float>(address + 0x144),
stamina: Kernel.Read<float>(address + 0x13C)
maxStamina: Kernel.Read<float>(address + 0x130),
stamina: Kernel.Read<float>(address + 0x12C)
);

if (cGuiStaminaAddress != Kernel.NULLPTR)
Expand Down Expand Up @@ -1066,13 +1065,16 @@ private void GetPlayerAilment(long address)
if (PlayerActionRef.Contains("SLEEP"))
{
AilmentType = PlayerAilment.Sleep;
} else if (PlayerActionRef.Contains("PARALYSE"))
}
else if (PlayerActionRef.Contains("PARALYSE"))
{
AilmentType = PlayerAilment.Paralysis;
} else if (PlayerActionRef.Contains("STUN"))
}
else if (PlayerActionRef.Contains("STUN"))
{
AilmentType = PlayerAilment.Stun;
} else
}
else
{
AilmentType = PlayerAilment.None;
AilmentTimer = 0;
Expand Down Expand Up @@ -1129,7 +1131,8 @@ private void GetSecondaryMantle()
private void GetMantleTimers()
{
Mantle[] mantles = new Mantle[] { PrimaryMantle, SecondaryMantle };
foreach (Mantle mantle in mantles) {
foreach (Mantle mantle in mantles)
{
long mantleTimerFixed = (mantle.ID * 4) + Address.TimerFixed;
long mantleTimer = (mantle.ID * 4) + Address.TimerDynamic;
long mantleCdFixed = (mantle.ID * 4) + Address.CooldownFixed;
Expand Down Expand Up @@ -1198,7 +1201,7 @@ private void GetParty()
PlayerParty[i].SetPlayerInfo(dummy, !PlayerParty.IsExpedition);
}

if(!PlayerParty.IsExpedition)
if (!PlayerParty.IsExpedition)
PlayerParty.TotalDamage = totalDamage;
}

Expand Down Expand Up @@ -1247,7 +1250,7 @@ private string GetPartyMemberName(long NameAddress)
private void GetFertilizers()
{
long address = LEVEL_ADDRESS + Offsets.FertilizersOffset - 0xC;

sItem[] fertilizers = Kernel.ReadStructure<sItem>(address, 4);

for (int i = 0; i < fertilizers.Length; i++)
Expand Down Expand Up @@ -1365,7 +1368,8 @@ private void UpdateAbnormality(AbnormalityInfo info, long baseAddress, float[] c
if (cached != null)
{
duration = cached[(info.Offset - firstHornBuffOffset) / sizeof(float)];
} else
}
else
{
duration = Kernel.Read<float>(abnormalityAddress);
}
Expand Down Expand Up @@ -1497,7 +1501,7 @@ private void GetJobInformation()
CurrentWeapon.SafijiivaRegenCounter = SafiCounter;
GetWeaponSharpness(weaponAddress);
}

ClassAddress = weaponAddress;
}

Expand Down Expand Up @@ -1733,7 +1737,7 @@ private void GetHeavyBowgunInformation(long weaponAddress)
sAmmo[] ammos = Kernel.ReadStructure<sAmmo>(weaponAddress + 0x34, 40);
HeavyBowgun.UpdateInformation(data, ammos);
}
#endregion
#endregion

private float CalculatePowerProlongerMultiplier()
{
Expand All @@ -1743,7 +1747,8 @@ private float CalculatePowerProlongerMultiplier()
if ((Classes)WeaponID == Classes.SwitchAxe || (Classes)WeaponID == Classes.DualBlades)
{
return 1.0f + ((float)Math.Pow(2, level - 1) / 10.0f) + (2 * (float)level / 10);
} else
}
else
{
return 1.0f + (float)Math.Pow(2, level - 1) / 10.0f;
}
Expand Down
6 changes: 4 additions & 2 deletions HunterPie.Core/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.5.28")]
[assembly: AssemblyFileVersion("1.0.5.28")]
[assembly: AssemblyVersion("1.0.5.30")]
[assembly: AssemblyFileVersion("1.0.5.30")]
[assembly: Guid("e688b55e-9431-11eb-a142-d017c28e3396")]
[assembly: NeutralResourcesLanguage("en")]

[assembly: AssemblyInformationalVersion("0.0.0.2")]
8 changes: 4 additions & 4 deletions HunterPie.Native/HunterPie.Native.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,26 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
Expand Down
8 changes: 5 additions & 3 deletions HunterPie.UI/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Resources;
using System.Resources;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
Expand Down Expand Up @@ -33,6 +33,8 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.5.30")]
[assembly: AssemblyFileVersion("1.0.5.30")]
[assembly: AssemblyVersion("1.0.5.32")]
[assembly: AssemblyFileVersion("1.0.5.32")]
[assembly: NeutralResourcesLanguage("en")]

[assembly: AssemblyInformationalVersion("0.0.0.2")]
3 changes: 3 additions & 0 deletions HunterPie/HunterPie.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Core\Client\AutoUpdate.cs" />
<None Include="address\MonsterHunterWorld.421631.map">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="address\MonsterHunterWorld.421471.map">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down
10 changes: 6 additions & 4 deletions HunterPie/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Reflection;
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
using System.Windows;
Expand All @@ -12,7 +12,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Haato")]
[assembly: AssemblyProduct("HunterPie")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand Down Expand Up @@ -53,7 +53,9 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.5.46")]
[assembly: AssemblyFileVersion("1.0.5.46")]
[assembly: AssemblyVersion("1.0.6.1")]
[assembly: AssemblyFileVersion("1.0.6.1")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: Guid("84334de6-935b-11eb-9b81-d017c28e3396")]

[assembly: AssemblyInformationalVersion("0.0.0.3")]
69 changes: 69 additions & 0 deletions HunterPie/address/MonsterHunterWorld.421631.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Addresses
Address BASE 0x140000000
Address CANTEEN_OFFSET 0x04F859F0
Address MONSTER_SELECTED_OFFSET 0x04F9D798
Address PLAYER_DATA_OFFSET 0x04F9D798
Address ZONE_OFFSET 0x0500CA60
Address MONSTER_TARGETED_OFFSET 0x05011640
Address LEVEL_OFFSET 0x05011710
Address WEAPON_OFFSET 0x05011760
Address WEAPON_MECHANICS_OFFSET 0x05011760
Address EQUIPMENT_OFFSET 0x05011760
Address ABNORMALITY_OFFSET 0x05011760
Address MONSTER_OFFSET 0x05121688
Address ITEM_DATA_OFFSET 0x051C2400
Address PARTY_OFFSET 0x051C2478
Address SESSION_OFFSET 0x051C2478
Address DAMAGE_OFFSET 0x051C2478
Address WORLD_DATA_OFFSET 0x050115F0
Address WEAPON_DATA_OFFSET 0x0500FE40
Address HUD_DATA_OFFSET 0x0500CA60
Address GAME_INPUT_OFFSET 0x051C3170
Address GAME_FRAME_COUNT_OFFSET 0x051C7908
Address GAME_RENDER_INFO_OFFSET 0x051C1F08
Address GAME_MOUSE_INFO_OFFSET 0x051C31B0
Address GAME_HUD_INFO_OFFSET 0x051C2400
Address GAME_CHAT_OFFSET 0x0500AC30
Address SETTINGS_KEYBOARD 0x051C3170
# Game Data
Address MUSIC_SKILL_EFC_DATA_OFFSET 0x0500FE30
# GMD Strings
Address GMD_ITEMS_OFFSET 0x05010C20
Address GMD_BUFFS_OFFSET 0x05010C50
Address GMD_MONSTERS_OFFSET 0x05010C60
# Functions
Address FUN_GAME_INPUT 0x0022E6110
Address FUN_CHAT_SYSTEM 0x01A53400
Address FUN_DEAL_DAMAGE 0x01CC51B0
# Offsets
Offset LevelOffsets 0xA8
Offset ZoneOffsets 0xAED0
Offset SessionOffsets 0x68,0x1D0,0x208,0x30,0x3C8
Offset WeaponOffsets 0x50,0xC0,0x8,0x78,0x2E8
Offset MonsterOffsets 0x698,0x0,0x138,0x0
Offset EquipmentOffsets 0x50,0x80,0x80,0x18,0x460
Offset PartyOffsets 0x68,0x0
Offset DamageOffsets 0x258,0x38,0x450,0x8,0x48
Offset AbnormalityOffsets 0x50,0x7D20,0x0
Offset SkillOffsets 0x50,0x7D20,0x10,0x78
Offset AbnormalityGearOffsets 0x50,0x12608,0x0
Offset MonsterSelectedOffsets 0x48,0x1760,0x100,0x0
Offset PlayerGearOffsets 0x50,0x12610,0xCC
Offset PlayerLockonOffsets 0x50,0x80,0x80,0x0
Offset WeaponMechanicsOffsets 0x50,0x98,0x10,0x70,0x18,0x550,0x236C
Offset PlayerPositionOffsets 0x50,0xC0,0x670
Offset PlayerBasicInformationOffsets 0x50,0x7630,0x0
Offset WeaponDataOffsets 0xC8
Offset ItemDataOffsets 0x140C0
Offset gHudStaminaBarOffsets 0xB3C8,0x8,0x0
Offset gHudHealthBarOffsets 0xB2A0,0x8,0x0
Offset FoodDataOffsets 0x80,0x7D20,0x18,0x0
Offset PlayerCanteenTimer 0x0
# Game Data
Offset cMusicSkillEfcDataOffsets 0xC8,0x0
Offset cMhMouseOffsets 0x170
# GMD Offsets
Offset GmdOffsets 0xF8
Offset GmdItemsOffsets 0xF8
Offset GameInputArrayOffsets 0x138
Offset sMhGUIOffsets 0x14060,0x22C2