mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-13 12:14:18 +01:00
Fix stain applying to 0-weapons in general.
This commit is contained in:
parent
282f7791bf
commit
25cded7f9f
1 changed files with 8 additions and 2 deletions
|
|
@ -40,7 +40,8 @@ public unsafe class WeaponService : IDisposable
|
||||||
private readonly Hook<LoadWeaponDelegate> _loadWeaponHook;
|
private readonly Hook<LoadWeaponDelegate> _loadWeaponHook;
|
||||||
|
|
||||||
|
|
||||||
private void LoadWeaponDetour(DrawDataContainer* drawData, uint slot, ulong weaponValue, byte redrawOnEquality, byte unk2, byte skipGameObject, byte unk4)
|
private void LoadWeaponDetour(DrawDataContainer* drawData, uint slot, ulong weaponValue, byte redrawOnEquality, byte unk2,
|
||||||
|
byte skipGameObject, byte unk4)
|
||||||
{
|
{
|
||||||
var actor = (Actor)((nint*)drawData)[1];
|
var actor = (Actor)((nint*)drawData)[1];
|
||||||
var weapon = new CharacterWeapon(weaponValue);
|
var weapon = new CharacterWeapon(weaponValue);
|
||||||
|
|
@ -58,7 +59,12 @@ public unsafe class WeaponService : IDisposable
|
||||||
|
|
||||||
_loadWeaponHook.Original(drawData, slot, weapon.Value, redrawOnEquality, unk2, skipGameObject, unk4);
|
_loadWeaponHook.Original(drawData, slot, weapon.Value, redrawOnEquality, unk2, skipGameObject, unk4);
|
||||||
if (tmpWeapon.Value != weapon.Value)
|
if (tmpWeapon.Value != weapon.Value)
|
||||||
|
{
|
||||||
|
if (tmpWeapon.Set.Value == 0)
|
||||||
|
tmpWeapon.Stain = 0;
|
||||||
_loadWeaponHook.Original(drawData, slot, tmpWeapon.Value, 1, unk2, 1, unk4);
|
_loadWeaponHook.Original(drawData, slot, tmpWeapon.Value, 1, unk2, 1, unk4);
|
||||||
|
}
|
||||||
|
|
||||||
Glamourer.Log.Excessive(
|
Glamourer.Log.Excessive(
|
||||||
$"Weapon reloaded for 0x{actor.Address:X} ({actor.Utf8Name}) with attributes {slot} {weapon.Value:X14}, {redrawOnEquality}, {unk2}, {skipGameObject}, {unk4}");
|
$"Weapon reloaded for 0x{actor.Address:X} ({actor.Utf8Name}) with attributes {slot} {weapon.Value:X14}, {redrawOnEquality}, {unk2}, {skipGameObject}, {unk4}");
|
||||||
}
|
}
|
||||||
|
|
@ -84,7 +90,7 @@ public unsafe class WeaponService : IDisposable
|
||||||
|
|
||||||
public void LoadStain(Actor character, EquipSlot slot, StainId stain)
|
public void LoadStain(Actor character, EquipSlot slot, StainId stain)
|
||||||
{
|
{
|
||||||
var mdl = character.Model;
|
var mdl = character.Model;
|
||||||
var (_, _, mh, oh) = mdl.GetWeapons(character);
|
var (_, _, mh, oh) = mdl.GetWeapons(character);
|
||||||
var value = slot == EquipSlot.OffHand ? oh : mh;
|
var value = slot == EquipSlot.OffHand ? oh : mh;
|
||||||
var weapon = value.With(value.Set.Value == 0 ? 0 : stain);
|
var weapon = value.With(value.Set.Value == 0 ? 0 : stain);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue