Jump to content

Photo

How to keep modifications to Native's dlls?

css dll core smith energy

No replies to this topic

#1
EcneloivCM

EcneloivCM

    Stranger

  • Members
  • Pip
  • 1 posts

Hello,

 

I modified TaleWorlds.CampaignSystem.dll -> Sandbox.CampaignBehaviors -> CraftingCampaignBehavior -> HourlyTick() so that it becomes

 

    private void HourlyTick()
    {
      foreach (KeyValuePair<Hero, CraftingCampaignBehavior.HeroCraftingRecord> heroCraftingRecord in this._heroCraftingRecords)
      {
        if (heroCraftingRecord.Value.CraftingStamina < 100)
          heroCraftingRecord.Value.CraftingStamina = Math.Min(100, heroCraftingRecord.Value.CraftingStamina + 5);
      }
    }

In doing so, smithing energy is restored even outside of the town where it was depleted. I tried to include it in a mod by having the basic xml file pointing to it, though I'll admit I didn't expect it to work too well (it didn't). I then just copied that into the root/bin/Windows... folder and it now works.

 

How would I go about doing this properly? Is it even possible?

 

To be frank, I don't really understand the entry point we have into the game's code. It's all classes, but they have to be called somewhere. For instance, if I inherit from CraftingCampaignBehavior, and override the HourlyTick() method, how do I ensure it's my class that's used and not the parent class?

 

Thanks in advance,

 

EDIT: Just realized the redundancy of the if and min... That's the result of removing one of the two conditions in the if() clause. Whoever wrote that sure didn't want smithing energy to go past 100 !


Edited by EcneloivCM, 05 April 2020 - 03:28 PM.




Reply to this topic



  



Also tagged with one or more of these keywords: css, dll, core, smith, energy

IPB skins by Skinbox
Page loaded in: 0.942 seconds