public static bool RemoveUserFromSpace(Session Session, bool SendKick = true) { bool flag = false; uint absoluteSpaceId = Session.AbsoluteSpaceId; if (absoluteSpaceId > 0) { if (Session.SpaceJoined) { SpaceInstance instanceBySpaceId = GetInstanceBySpaceId(absoluteSpaceId); if (instanceBySpaceId != null) { instanceBySpaceId.RemoveCharacterFromSpace(Session.CharacterId); } } Session.AbsoluteSpaceId = 0; Session.SpaceAuthed = false; Session.SpaceJoined = false; LaptopHandler.MarkUpdateNeeded(Session, 0, false); flag = true; } if (SendKick) { Session.SendData(SpaceUserRemovedComposer.SingleCompose()); } return(flag); }
public bool AddUserToSpace(Session Session) { if ((Session.AbsoluteSpaceId == this.SpaceId) && Session.Authenticated) { if (this.HumanActorCount >= this.spaceInfo_0.MaxUsers) { Session.SendData(SpaceUserRemovedComposer.SingleCompose()); return(false); } uint num = this.method_3(); if ((num != 0) && (num <= 0x15)) { Vector3 position = new Vector3(this.spaceModel_0.DoorPosition.Int32_0, this.spaceModel_0.DoorPosition.Int32_1, 0); SpaceActor actor = SpaceActor.TryCreateActor(num, SpaceActorType.UserCharacter, Session.CharacterId, Session.CharacterInfo, position, this.spaceModel_0.CharacterRotation, this); if (actor == null) { return(false); } this.method_4(actor); if (Session.CurrentEffect > 0) { actor.ApplyEffect(Session.CurrentEffect, true); } actor.UpdateNeeded = true; return(true); } Session.SendData(SpaceUserRemovedComposer.SingleCompose()); return(false); } Session.SendData(SpaceUserRemovedComposer.SingleCompose()); return(false); }
private static void smethod_2(Session session_0, ClientMessage clientMessage_0) { if (session_0 != null) { if (!SpaceManager.InstanceIsLoadedForSpace(session_0.AbsoluteSpaceId)) { if (SpaceManager.TryLoadSpaceInstance(session_0.AbsoluteSpaceId)) { } else { Console.WriteLine("ERROR"); } } SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(session_0.AbsoluteSpaceId); if (instanceBySpaceId != null) { session_0.SpaceAuthed = true; } if (((instanceBySpaceId != null) && !session_0.SpaceJoined) && (session_0.SpaceAuthed && !instanceBySpaceId.Info.BlackList.Contains(session_0.CharacterInfo.Username))) { if (!instanceBySpaceId.AddUserToSpace(session_0)) { SpaceManager.RemoveUserFromSpace(session_0, true); } else { session_0.SpaceAuthed = true; session_0.SpaceJoined = true; instanceBySpaceId.SendObjects(session_0); LaptopHandler.MarkUpdateNeeded(session_0, 0, false); SpaceActor actorByReferenceId = instanceBySpaceId.GetActorByReferenceId(session_0.CharacterId, SpaceActorType.UserCharacter); if (actorByReferenceId == null) { session_0.SendData(SpaceUserRemovedComposer.SingleCompose()); } else { instanceBySpaceId.BroadcastMessage(SpaceObjectListComposer.BroadcastCompose(actorByReferenceId), session_0.CharacterId, true); } } } else { session_0.SendData(SpaceUserRemovedComposer.SingleCompose()); } } }
public void Unload() { if (!this.bool_0) { this.bool_0 = true; if (this.bool_1) { this.DoActorCountSync(); } this.BroadcastMessage(SpaceUserRemovedComposer.SingleCompose(), 0, false); lock (this.object_1) { this.concurrentDictionary_0.Clear(); } this.double_0 = UnixTimestamp.GetCurrent(); } }
private bool method_4(SpaceActor spaceActor_0) { lock (this.object_1) { if (this.concurrentDictionary_0.ContainsKey(spaceActor_0.UInt32_0)) { Session sessionByCharacterId = SessionManager.GetSessionByCharacterId(spaceActor_0.ReferenceId); if (sessionByCharacterId != null) { sessionByCharacterId.SendData(SpaceUserRemovedComposer.SingleCompose()); } return(false); } this.concurrentDictionary_0.TryAdd(spaceActor_0.UInt32_0, spaceActor_0); this.MarkActorCountSyncNeeded(); return(true); } }