public static void SetIncreasedByStat(this BlueprintAbilityResource resource, int baseValue, StatType stat) { var amount = getMaxAmount(resource); Helpers.SetField(amount, "BaseValue", baseValue); Helpers.SetField(amount, "IncreasedByStat", true); Helpers.SetField(amount, "ResourceBonusStat", stat); // Enusre arrays are at least initialized to empty. var emptyClasses = Array.Empty <BlueprintCharacterClass>(); var emptyArchetypes = Array.Empty <BlueprintArchetype>(); var field = "Class"; if (Helpers.GetField(amount, field) == null) { Helpers.SetField(amount, field, emptyClasses); } field = "ClassDiv"; if (Helpers.GetField(amount, field) == null) { Helpers.SetField(amount, field, emptyClasses); } field = "Archetypes"; if (Helpers.GetField(amount, field) == null) { Helpers.SetField(amount, field, emptyArchetypes); } field = "ArchetypesDiv"; if (Helpers.GetField(amount, field) == null) { Helpers.SetField(amount, field, emptyArchetypes); } setMaxAmount(resource, amount); }
public static void SetIncreasedByLevelStartPlusDivStep(this BlueprintAbilityResource resource, int baseValue, int startingLevel, int startingIncrease, int levelStep, int perStepIncrease, int minClassLevelIncrease, float otherClassesModifier, BlueprintCharacterClass[] classes, BlueprintArchetype[] archetypes = null) { var amount = getMaxAmount(resource); Helpers.SetField(amount, "BaseValue", baseValue); Helpers.SetField(amount, "IncreasedByLevelStartPlusDivStep", true); Helpers.SetField(amount, "StartingLevel", startingLevel); Helpers.SetField(amount, "StartingIncrease", startingIncrease); Helpers.SetField(amount, "LevelStep", levelStep); Helpers.SetField(amount, "PerStepIncrease", perStepIncrease); Helpers.SetField(amount, "MinClassLevelIncrease", minClassLevelIncrease); Helpers.SetField(amount, "OtherClassesModifier", otherClassesModifier); Helpers.SetField(amount, "ClassDiv", classes); var emptyArchetypes = Array.Empty <BlueprintArchetype>(); Helpers.SetField(amount, "ArchetypesDiv", archetypes ?? emptyArchetypes); // Enusre arrays are at least initialized to empty. var fieldName = "Class"; if (Helpers.GetField(amount, fieldName) == null) { Helpers.SetField(amount, fieldName, Array.Empty <BlueprintCharacterClass>()); } fieldName = "Archetypes"; if (Helpers.GetField(amount, fieldName) == null) { Helpers.SetField(amount, fieldName, emptyArchetypes); } setMaxAmount(resource, amount); }
//static readonly Type blueprintAbilityResource_Amount = Harmony12.AccessTools.Inner(typeof(BlueprintAbilityResource), "Amount"); public static void SetIncreasedByLevel(this BlueprintAbilityResource resource, int baseValue, int levelIncrease, BlueprintCharacterClass[] classes, BlueprintArchetype[] archetypes = null) { var amount = getMaxAmount(resource); Helpers.SetField(amount, "BaseValue", baseValue); Helpers.SetField(amount, "IncreasedByLevel", true); Helpers.SetField(amount, "LevelIncrease", levelIncrease); Helpers.SetField(amount, "Class", classes); var emptyArchetypes = Array.Empty <BlueprintArchetype>(); Helpers.SetField(amount, "Archetypes", archetypes ?? emptyArchetypes); // Enusre arrays are at least initialized to empty. var field = "ClassDiv"; if (Helpers.GetField(amount, field) == null) { Helpers.SetField(amount, field, Array.Empty <BlueprintCharacterClass>()); } field = "ArchetypesDiv"; if (Helpers.GetField(amount, field) == null) { Helpers.SetField(amount, field, emptyArchetypes); } setMaxAmount(resource, amount); }
internal static BuffFlags GetBuffFlags(this BlueprintBuff buff) { return((BuffFlags)(int)Helpers.GetField(buff, "m_Flags")); }