static bool Prefix(TreasureRevealer __instance) { if (!enabled) { return(true); } if (tril.Count == 0) { GetAllTreasures(__instance); } float maxDistance = Module <TreasureRevealerManager> .Self.property.detectRange * settings.RangeMult; TreasureRevealerItem.ModeEnum mEnum = (!Module <TreasureRevealerManager> .Self.property.showBorder) ? TreasureRevealerItem.ModeEnum.Selection : TreasureRevealerItem.ModeEnum.Border; for (int i = 0; i < tril.Count; i++) { TreasureRevealerItem tri = tril[i]; if (tri != null && tri.gameObject != null && Vector3.Distance(Module <Player> .Self.GamePos, tri.pos) <= maxDistance) { tri.ResetState(mEnum, Module <TreasureRevealerManager> .Self.property.showName); } else { tri.ResetState(TreasureRevealerItem.ModeEnum.Preview, false); } } return(false); }
static void Postfix(TreasureRevealer __instance) { if (!enabled) { return; } Dbgl("destroying"); for (int i = 0; i < tril.Count; i++) { TreasureRevealerItem tri = tril[i]; if (tri != null && tri.gameObject != null) { UnityEngine.Object.Destroy(tri.gameObject); UnityEngine.Object.Destroy(tri); } } tril.Clear(); }