using BepInEx; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using CsvHelper; using Il2CppInterop.Runtime; using Photon.Pun; using System; using System.Collections.Generic; using System.Globalization; using System.IO; namespace PhotonViewDumper; public class ViewElement { public int RecNetId { get; set; } public int ActorId { get; set; } public string NickName { get; set; } public string RecNetUserName { get; set; } public int ViewId { get; set; } public string PrefabName { get; set; } } [BepInPlugin("dev.proxnet.recroom.photonviewdumper", "PhotonViewDumper", "0.1.0")] public class Plugin : BasePlugin { public static new ManualLogSource Log; public override void Load() { Log = base.Log; Log.LogInfo($"Loaded"); AddComponent(); } public static void Dump() { List views = new(); foreach (PhotonView view in PhotonNetwork.PhotonViews) { try { var recNetId = view.Owner == null ? -1 : view.Owner.RecNetAccountId; CCEOLAOLEKJ recNetAccount = null; PEGGCEDHBOF.DKNKKLPCGLM.TryGetValue(recNetId, out recNetAccount); views.Add(new ViewElement { RecNetId = recNetId, ActorId = view.Owner == null ? -1 : view.Owner.ActorNumber, NickName = view.Owner == null ? "" : view.Owner.nickName, RecNetUserName = recNetAccount == null ? "" : recNetAccount.BIOGKFGIMDG.ToString(), ViewId = view.ViewID, PrefabName = view.name }); } catch (Exception ex) { Log.LogWarning($"Failed to dump view {view.ViewID}: {ex}"); } } using var writer = new StreamWriter("views.csv"); using var csv = new CsvWriter(writer, CultureInfo.InvariantCulture); csv.WriteRecords(views); Log.LogInfo($"Wrote {views.Count} to views.csv"); } }