using OWML.Common; using QSB.ItemSync.WorldObjects; using QSB.Utility; using QSB.WorldSync; namespace QSB.ItemSync { internal class ItemManager : WorldObjectManager { protected override void RebuildWorldObjects(OWScene scene) { DebugLog.DebugWrite("Rebuilding OWItems...", MessageType.Info); QSBWorldSync.Init(); QSBWorldSync.Init(); QSBWorldSync.Init(); QSBWorldSync.Init(); QSBWorldSync.Init(); QSBWorldSync.Init(); QSBWorldSync.Init(); QSBWorldSync.Init(); } public static IQSBOWItem GetObject(OWItem unityObject) { if (unityObject == null) { DebugLog.ToConsole($"Error - Trying to run GetObject (Item) with null unity object!", MessageType.Error); return default; } IQSBOWItem worldObj = null; if (unityObject.GetType() == typeof(ScrollItem)) { worldObj = QSBWorldSync.GetWorldFromUnity((ScrollItem)unityObject); } else if (unityObject.GetType() == typeof(SharedStone)) { worldObj = QSBWorldSync.GetWorldFromUnity((SharedStone)unityObject); } else if (unityObject.GetType() == typeof(WarpCoreItem)) { worldObj = QSBWorldSync.GetWorldFromUnity((WarpCoreItem)unityObject); } else if (unityObject.GetType() == typeof(NomaiConversationStone)) { worldObj = QSBWorldSync.GetWorldFromUnity((NomaiConversationStone)unityObject); } else { DebugLog.ToConsole($"Warning - couldn't work out type of OWItem {unityObject.name}.", MessageType.Warning); } return worldObj; } public static IQSBOWItemSocket GetObject(OWItemSocket unityObject) { if (unityObject == null) { DebugLog.ToConsole($"Error - Trying to run GetObject (Socket) with null unity object!", MessageType.Error); return default; } IQSBOWItemSocket worldObj = null; if (unityObject.GetType() == typeof(ScrollSocket)) { worldObj = QSBWorldSync.GetWorldFromUnity((ScrollSocket)unityObject); } else if (unityObject.GetType() == typeof(SharedStoneSocket)) { worldObj = QSBWorldSync.GetWorldFromUnity((SharedStoneSocket)unityObject); } else if (unityObject.GetType() == typeof(WarpCoreSocket)) { worldObj = QSBWorldSync.GetWorldFromUnity((WarpCoreSocket)unityObject); } else if (unityObject.GetType() == typeof(NomaiConversationStoneSocket)) { worldObj = QSBWorldSync.GetWorldFromUnity((NomaiConversationStoneSocket)unityObject); } else { DebugLog.ToConsole($"Warning - couldn't work out type of OWItemSocket {unityObject.name}.", MessageType.Warning); } return worldObj; } } }