static void PostfixUpdate(ref Pathea.ActorNs.Actor __instance) { if (Input.GetKeyDown(Main.modSettings.DebugKey.keyCode)) { if (__instance.IsActorType(Pathea.ActorNs.ActorTag.Npc)) { Main.dmp("NPC", __instance.name); Main.dmp("-- can Date ", Pathea.FavorSystemNs.FavorRelationshipUtil.CanDate(__instance.InstanceId)); Main.dmp("-- Favor", Pathea.FavorSystemNs.FavorManager.Self.GetFavorObject(__instance.InstanceId).FavorValue); Main.dmp("-- Level", __instance.Level.ToString()); Main.dmp("-- Atk", __instance.ConstAttrAttack); Main.dmp("-- Def", __instance.ConstAttrDefence); Main.dmp("-- HpMax", __instance.ConstAttrHpMax); Main.dmp("-- CpMax", __instance.ConstAttrCpMax); } } //if (__instance.IsActorType(ActorTag.Player)/* && Input.GetKeyDown(Main.modSettings.DebugKey.keyCode)*/) //{ // // Main.dump("actor collider"); // Ray ray = default; // RaycastHit[] hits = new RaycastHit[2]; // ray.origin = __instance.gamePos; // ray.direction = Vector3.down; // int num = global::UnityEngine.Physics.RaycastNonAlloc(ray, hits, __instance.GetActorHeight(), 16); // for (int i = 0; i < num; i++) // { // RaycastHit raycastHit = hits[i]; // //Main.dump(raycastHit.ToString()); // //Main.dmp("raycastHit.distance", raycastHit.distance); // //Main.dmp("raycastHit.collider.gameObject.layer", raycastHit.collider.gameObject.layer); // //Main.dmp("raycastHit.collider.gameObject.name" , raycastHit.collider.gameObject.name); // //Main.dump(raycastHit.collider.ToString()); // if ("SeaPlane_Splite" == raycastHit.collider.gameObject.name) // { // Vector3 pos = __instance.gamePos; // pos.y = ray.origin.y - raycastHit.distance; // __instance.gamePos = pos; // } // } // //RaycastHit hit2 = new RaycastHit(); // //__instance.GetCollider().Raycast(ray, out hit2, 10f); // //if (null != hit2.collider) // //{ // // Main.dmp("hit2.distance ", hit2.distance); // // Main.dmp("hit2.collider.gameObject.name", hit2.collider.gameObject.name); // //} // //Main.dump("actor collider end"); //} }
static void PostfixConstAttrVpMax(ref float __result, Pathea.ActorNs.Actor __instance) { if (!__instance.IsActorType(ActorTag.Player)) { return; } __result *= Main.modSettings.PlayerStatsMultiplier; }
static void PostfixConstAttrRangeCriticalAmount(ref float __result, Pathea.ActorNs.Actor __instance) { if (!__instance.IsActorType(ActorTag.Player)) { return; } __result *= Main.modSettings.PlayerCriticalAmountMultiplier; }
static void PostfixConstAttrHpMax(ref float __result, Pathea.ActorNs.Actor __instance) { if (__instance.IsActorType(ActorTag.Player)) { __result *= Main.modSettings.PlayerStatsMultiplier; } else if (Pathea.FavorSystemNs.FavorRelationshipUtil.CanDate(__instance.InstanceId)) { __result *= Main.modSettings.SweetHeartbuff; } }
static void PrefixApplySubModel(int slot, string subModelInfo, ref Pathea.ActorNs.Actor __instance) { // just assume something's changed. // reset scaling so it gets picked up by update if (null != __instance.GetHead()) { __instance.GetHead().localScale = Main.resetVector; } if (null != __instance.modelRoot) { __instance.modelRoot.transform.localScale = Main.resetVector; } }
static void PostfixOnDeath(ref Pathea.ActorNs.Actor __instance) { if ( 0 != Main.modSettings.GhostGameMoodBonusPerKill && __instance.FactionId == GhostCaveCenter.ghostFactionId && GhostCaveCenter.Instance.Game != null && Pathea.EG.EGMgr.Self.IsEngagementEvent() ) { Main.mod.Logger.Log("Killed ghost on playdate"); Pathea.EG.EGMgr.Self.AddMood(Main.modSettings.GhostGameMoodBonusPerKill); //GhostCaveCenter.Instance.Game.ChangeMood(Main.modSettings.GhostGameMoodBonusPerKill); } }
// rescale an actor if possible public static void rescaleActor(Pathea.ActorNs.Actor __instance) { if (__instance == null) { return; } if ( __instance.IsActorType(ActorTag.Npc) || __instance.IsActorType(ActorTag.Player) ) { Transform head = __instance.GetHead(); if (null != head && head.localScale != Main.headScaleVector) { // todo make preset. string modelType = Pathea.ActorNs.ActorMgr.Self.GetActorInfo(__instance.TmpltId).modelType; if (Main.headScaleVectorByTag.ContainsKey(modelType)) { head.localScale = Main.headScaleVectorByTag[modelType]; } else { head.localScale = Main.headScaleVector; } } } if (null != __instance.modelRoot) { bool female = false; // reset scale when sleeping to prevent clipping. // might get weird. if ( __instance.IsSleeping() || __instance.IsActionRunning(ACType.Sit) ) { __instance.modelRoot.transform.localScale = Main.resetVector; } else if (System.Object.ReferenceEquals(__instance, Player.Self.actor)) { __instance.modelRoot.transform.localScale = Main.playerScaleVector; if (Player.Self.GetGender() == Gender.Female) { female = true; } } else if (__instance.IsActorType(ActorTag.Npc)) { __instance.modelRoot.transform.localScale = Main.actorScaleVector; if (Pathea.NpcRepositoryNs.NpcRepository.Self.GetNpcGender(__instance.InstanceId) == Gender.Female) { female = true; } } // attempt to give wider hip. if ( female && !skipFemaleHipMod.Contains(__instance.name) && null != __instance.ikController && null != __instance.ikController.ik && ( __instance.ikController.ik.references.pelvis.localScale != Main.hipScaleVector // || __instance.ikController.ik.references.pelvis.localPosition != Main.hipOffsetVector ) ) { //Bip001 Pelvis //IEnumerable<Transform> bipPelvis = __instance.GetComponents<Transform>().Where(b => b.name == "Bip001 Pelvis"); //foreach (Transform pelvisBone in bipPelvis) //{ // Main.mod.Logger.Log(string.Format("bipPelvis {0} {1}", __instance.name, pelvisBone.ToString())); // Transform[] children = pelvisBone.Cast<Transform>().ToArray(); // pelvisBone.DetachChildren(); // pelvisBone.localScale = Main.hipScaleVector; // pelvisBone.localPosition = Main.hipOffsetVector; // foreach (Transform child in children) // { // child.parent = pelvisBone; // } //} Transform pelvisBone = __instance.ikController.ik.references.pelvis; if (null != pelvisBone) { Transform[] children = pelvisBone.Cast <Transform>().ToArray(); pelvisBone.DetachChildren(); pelvisBone.localScale = Main.hipScaleVector; //pelvisBone.localPosition = Main.hipOffsetVector; foreach (Transform child in children) { child.parent = pelvisBone; } } } } }
static void PostfixUpdateSubModel(ref Pathea.ActorNs.Actor __instance) { //rescaleActor(__instance); }
static void PostfixUpdate(ref Pathea.ActorNs.Actor __instance) { // todo OnUpdate might be too often. rescaleActor(__instance); }
static void PostUpdateApplySubModel(ref Pathea.ActorNs.Actor __instance) { //femaleHipProcessed.Remove(__instance.GetInstanceID()); rescaleActor(__instance); }
static void PrefixHpChangeEventTrigger(Pathea.SkillNs.Caster caster, float hpChangeOrigin, float hpChanged, bool critical, Pathea.ActorNs.Actor __instance) { if (!Main.enabled) { return; } // if player did it. if (System.Object.ReferenceEquals(caster.Castable, Player.Self.actor)) { Player.Self.ChangeHp(Main.modSettings.HealthLeech); Player.Self.ChangeStamina(Main.modSettings.StaminaLeech); } }