public static void CreateSession() { NetworkSessionType sessionType = (Main.netMode != 0) ? NetworkSessionType.PlayerMatch : NetworkSessionType.Local; try { List <SignedInGamer> list = new List <SignedInGamer>(1); list.Add(UI.main.signedInGamer); NetworkSessionProperties networkSessionProperties = new NetworkSessionProperties(); ulong xuid = UI.main.signedInGamer.GetXuid(); if (UI.main.isInviteOnly) { networkSessionProperties[2] = -559038737; } else { networkSessionProperties[0] = (int)xuid; networkSessionProperties[1] = (int)(xuid >> 32); } int maxGamers = 8; int privateGamerSlots = 0; if (!Main.IsTutorial() && UI.main.isInviteOnly) { privateGamerSlots = 7; } session = NetworkSession.Create(sessionType, list, maxGamers, privateGamerSlots, networkSessionProperties); session.AllowJoinInProgress = true; session.AllowHostMigration = false; hookEvents = true; session.StartGame(); } catch (Exception) { UI.Error(Lang.menu[5], Lang.inter[20]); UI.main.menuType = MenuType.MAIN; Main.netMode = 0; disconnect = true; } }