-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
51 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
ToggleableThrowingWeapons/Patch/PatchWeaponCategoryExtension.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using HarmonyLib; | ||
using Kingmaker.Enums; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace ToggleableThrowingWeapons.Patch | ||
{ | ||
class PatchWeaponCategoryExtension | ||
{ | ||
[HarmonyPatch(typeof(WeaponCategoryExtension), "HasSubCategory")] | ||
static class ApplyThrownFixToHasSubCategory | ||
{ | ||
|
||
[HarmonyPriority(Priority.Normal)] | ||
public static void Postfix(ref bool __result, WeaponCategory category, WeaponSubCategory subCategory) | ||
{ | ||
if ((category == WeaponCategory.Dagger || category == WeaponCategory.Starknife) && subCategory == WeaponSubCategory.Ranged) | ||
{ | ||
__result = true; | ||
} | ||
} | ||
} | ||
|
||
[HarmonyPatch(typeof(WeaponCategoryExtension), "GetSubCategories")] | ||
static class ApplyThrownFixToGetSubCategories | ||
{ | ||
|
||
[HarmonyPriority(Priority.Normal)] | ||
public static void Postfix(ref WeaponSubCategory[] __result, WeaponCategory category) | ||
{ | ||
if ((category == WeaponCategory.Dagger || category == WeaponCategory.Starknife) && !__result.Contains(WeaponSubCategory.Ranged)) | ||
{ | ||
__result = __result.Append(WeaponSubCategory.Ranged).ToArray(); | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters