private int OnGetWeaponSpecialization(void *pStats, void *pWeapon) { CNWSCreatureStats stats = CNWSCreatureStats.FromPointer(pStats); uint weaponType = pWeapon == null ? (uint)BaseItem.Gloves : CNWSItem.FromPointer(pWeapon).m_nBaseItem; bool hasApplicableFeat = false; bool applicableFeatExists = weaponSpecializationMap.TryGetValue(weaponType, out HashSet <ushort>?types); if (applicableFeatExists) { foreach (ushort feat in types !) { hasApplicableFeat = stats.HasFeat(feat).ToBool(); if (hasApplicableFeat) { break; } } } return(applicableFeatExists && hasApplicableFeat ? 1 : getWeaponSpecializationHook.CallOriginal(pStats, pWeapon)); }
private static int OnCheckProficiencies(void *pCreature, void *pItem, uint nEquipToSlot) { NwCreature?creature = CNWSCreature.FromPointer(pCreature).ToNwObject <NwCreature>(); NwItem? item = CNWSItem.FromPointer(pItem).ToNwObject <NwItem>(); if (creature == null || item == null) { return(Hook.CallOriginal(pCreature, pItem, nEquipToSlot)); } OnCreatureCheckProficiencies eventData = ProcessEvent(new OnCreatureCheckProficiencies { Creature = creature, Item = item, TargetSlot = (EquipmentSlots)nEquipToSlot, }); return(eventData.ResultOverride switch { CheckProficiencyOverride.HasProficiency => true.ToInt(), CheckProficiencyOverride.NoProficiency => false.ToInt(), _ => Hook.CallOriginal(pCreature, pItem, nEquipToSlot), });