How would one add a custom PartyWageModel implementation and what do I need to patch in order for that implementation to be used by the Campaign System?
I would like to add my custom class to the game -
So now that I have built it, I would like to substitute it for DefaultPartyWageModel which currently in use. How would one go about doing that?
I know that I will still need harmony to patch CharacterObject.TroopWage but would like to know if I can add my wage model without patching the already existing one.
Clarification: I have already added the model by using the following method, need help now telling the game to use it!
Thanks!
I would like to add my custom class to the game -
C#:
public class BSIPartyWageModel : PartyWageModel
{
public override int GetTotalWage(MobileParty mobileParty, StatExplainer explanation = null)
{ MyCodeHere }
private static void CalculatePartialGarrisonWageReduction(
float troopRatio,
MobileParty mobileParty,
PerkObject perk,
ref ExplainedNumber garrisonWageReductionMultiplier,
bool isSecondaryEffect)
{My Code Here }
public override int GetGoldCostForUpgrade(
PartyBase party,
CharacterObject characterObject,
CharacterObject upgradeTarget) { My Code Here }
public override int GetTroopRecruitmentCost(
CharacterObject troop,
Hero buyerHero,
bool withoutItemCost = false
)
{My Code Here }
}
So now that I have built it, I would like to substitute it for DefaultPartyWageModel which currently in use. How would one go about doing that?
I know that I will still need harmony to patch CharacterObject.TroopWage but would like to know if I can add my wage model without patching the already existing one.
Clarification: I have already added the model by using the following method, need help now telling the game to use it!
Code:
protected override void OnGameStart(Game game, IGameStarter gameStarterObject)
{
if (game.GameType is Campaign)
{
CampaignGameStarter cgs = gameStarterObject as CampaignGameStarter;
cgs.AddModel(new MyCustomPartyWageModel());
}
}
Thanks!
Last edited: