Trouble changing skill formula

Started by Greep, March 27, 2017, 05:45:47 AM

Previous topic - Next topic

Greep

So I've been learning detours/patching and I've been able to do everything I want so far except change  the formula for experience levels.  I thought at first I was just making mistakes in detours, but since everything else is working like raid changes, etc, maybe I'm just not understanding the code.

I tried something really basic like:

    public static class GeneralBalanceStatic
    {
        [DetourMethod(typeof(Pawn), "GetInspectString")]
        private static string GetInspectString(this Pawn self)
        {
            Log.Warning("EH?");
            return self.Label + " test";
        }

        [DetourMethod(typeof(SkillRecord), "XpRequiredToLevelUpFrom")]
        private static float XpRequiredToLevelUpFrom(this SkillRecord self, int startingLevel)
        {
            Log.Warning("EH2?");
            return 5000f;
        }
    }

And the top (an example from hugslib) does execute correctly, while the bottom just never seems to run, no errors.  Tried patching from harmony as well.  I'm really new to this, so maybe I'm doing the detours correctly but just not reading the Rimworld code right.  I'm using ILSpy as instructed from the modding tutorials wiki, and skillrecord seems to be where everything is.  I even successfully changed the skill decay by altering Interval, although I also had trouble changing XpRequiredForLevelUp to do anything whereas I could successfully get that hugslib example involving properties to work as well.  So I'm just confused here.
1.0 Mods: Raid size limiter:
https://ludeon.com/forums/index.php?topic=42721.0

MineTortoise:
https://ludeon.com/forums/index.php?topic=42792.0
HELLO!

(WIPish)Strategy Mode: The experienced player's "vanilla"
https://ludeon.com/forums/index.php?topic=43044.0

RawCode

have you checked required method for inline case?
(if method is inlined, you will need to hook methods that "call" it instead)