Ejemplo n.º 1
0
        public override void Run()
        {
            var vanilla = this.Method(() => Terraria.Player.LoadPlayer(null, false));

            string tmp  = null;
            bool   tmp2 = false;

            global::Terraria.IO.PlayerFileData data = null;
            var cbkBegin =             //this.SourceDefinition.MainModule.Import(
                           this.Method(() => OTAPI.Callbacks.Terraria.Player.LoadBegin(ref data, ref tmp, ref tmp2));

            //);

            //var cbkEnd = this.SourceDefinition.MainModule.Import(
            //	this.Method(() => OTAPI.Callbacks.Terraria.Player.LoadEnd(null, false))
            //);

            vanilla.InjectNonVoidBeginCallback(cbkBegin);
            //vanilla.Wrap
            //(
            //	beginCallback: cbkBegin,
            //	endCallback: cbkEnd,
            //	beginIsCancellable: true,
            //	noEndHandling: false,
            //	allowCallbackInstance: false,
            //	overrideReturnType: vanilla.ReturnType
            //);
        }
Ejemplo n.º 2
0
        internal static bool SavePlayerBegin(global::Terraria.IO.PlayerFileData playerFile, ref bool skipMapSave)
        {
            var res = Hooks.Player.PreSave?.Invoke(playerFile, ref skipMapSave);

            if (res.HasValue)
            {
                return(res.Value == HookResult.Continue);
            }
            return(true);
        }
Ejemplo n.º 3
0
        internal static bool LoadBegin(ref global::Terraria.IO.PlayerFileData data, ref string playerPath, ref bool cloudSave)
        {
            var res = Hooks.Player.PreLoad?.Invoke(ref data, ref playerPath, ref cloudSave);

            if (res.HasValue)
            {
                return(res.Value == HookResult.Continue);
            }
            return(true);
        }
Ejemplo n.º 4
0
 internal static void SavePlayerEnd(global::Terraria.IO.PlayerFileData playerFile, bool skipMapSave) =>
 Hooks.Player.PostSave?.Invoke(playerFile, skipMapSave);