private static void smethod_18(Session session_0, ClientMessage clientMessage_0) { if (!session_0.CharacterInfo.IsMuted) { SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(session_0.CurrentSpaceId); if (instanceBySpaceId != null) { SpaceActor actorByReferenceId = instanceBySpaceId.GetActorByReferenceId(session_0.CharacterId, SpaceActorType.UserCharacter); if (actorByReferenceId != null) { CharacterInfo referenceObject = (CharacterInfo)actorByReferenceId.ReferenceObject; clientMessage_0.ReadUnsignedInteger(); string input = InputFilter.FilterString(clientMessage_0.ReadString().Trim(), false); int messageColor = clientMessage_0.ReadInteger(); if (input.Length != 0) { if (input.Length > 100) { input = input.Substring(0, 100); } if ((messageColor == 2) && (referenceObject.Staff == 0)) { messageColor = 1; } if (!input.StartsWith("@") || !ChatCommands.HandleCommand(session_0, input)) { actorByReferenceId.Chat(input, messageColor, referenceObject.Staff == 1); } } } } } }
private static void smethod_19(Session session_0, ClientMessage clientMessage_0) { if (!session_0.CharacterInfo.IsMuted) { uint actorId = clientMessage_0.ReadUnsignedInteger(); clientMessage_0.ReadUnsignedInteger(); string messageText = InputFilter.FilterString(clientMessage_0.ReadString().Trim(), false); clientMessage_0.ReadUnsignedInteger(); SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(session_0.CurrentSpaceId); if (instanceBySpaceId != null) { SpaceActor actorByReferenceId = instanceBySpaceId.GetActorByReferenceId(session_0.CharacterId, SpaceActorType.UserCharacter); if (actorByReferenceId != null) { SpaceActor actor = instanceBySpaceId.GetActor(actorId); if ((actor != null) && (messageText.Length != 0)) { if (messageText.Length > 100) { messageText = messageText.Substring(0, 100); } uint referenceId = actor.ReferenceId; if (referenceId > 0) { actorByReferenceId.Whisper(messageText, referenceId, false); } } } } } }
private static void smethod_22(Session session_0, ClientMessage clientMessage_0) { uint actorId = clientMessage_0.ReadUnsignedInteger(); uint num2 = clientMessage_0.ReadUnsignedInteger(); SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(session_0.CurrentSpaceId); if (instanceBySpaceId != null) { SpaceActor actor = instanceBySpaceId.GetActor(actorId); SpaceActor actor2 = instanceBySpaceId.GetActor(num2); if ((actor != null) && (actor2 != null)) { CharacterInfo referenceObject = (CharacterInfo)actor.ReferenceObject; CharacterInfo info2 = (CharacterInfo)actor2.ReferenceObject; if (!actor2.IsLocked) { using (SqlDatabaseClient client = SqlDatabaseManager.GetClient()) { referenceObject.UpdateGoldCreditsBalance(client, -25); referenceObject.UpdateCoconuts(client, true); info2.UpdateCoconuts(client, false); session_0.SendData(CharacterCoinsComposer.RemoveGoldCompose(0x19)); instanceBySpaceId.BroadcastMessage(SpaceUpdateUserStatistics.Compose(actor, 5), 0, false); instanceBySpaceId.BroadcastMessage(SpaceUpdateUserStatistics.Compose(actor2, 5), 0, false); actor2.Lock(6, false, true); instanceBySpaceId.BroadcastMessage(SpaceUserSendCoconut.SendAndBlock(actor2.ReferenceId), 0, false); } } } } }
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); }
public SpaceActor GetActor(uint ActorId) { SpaceActor actor = null; this.concurrentDictionary_0.TryGetValue(ActorId, out actor); return(actor); }
private static void smethod_21(Session session_0, ClientMessage clientMessage_0) { uint num2 = clientMessage_0.ReadUnsignedInteger(); SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(session_0.CurrentSpaceId); if (instanceBySpaceId != null) { SpaceActor actor = instanceBySpaceId.GetActorByReferenceId(session_0.CharacterId, SpaceActorType.UserCharacter); SpaceActor actor2 = instanceBySpaceId.GetActor(num2); if ((actor != null) && (actor2 != null)) { CharacterInfo referenceObject = (CharacterInfo)actor.ReferenceObject; CharacterInfo info2 = (CharacterInfo)actor2.ReferenceObject; if (!actor.IsLocked && !actor2.IsLocked) { actor.StopMoving(); using (SqlDatabaseClient client = SqlDatabaseManager.GetClient()) { referenceObject.UpdateGoldCreditsBalance(client, -250); referenceObject.UpdateUppercuts(client, true); info2.UpdateUppercuts(client, false); session_0.SendData(CharacterCoinsComposer.RemoveGoldCompose(250)); instanceBySpaceId.BroadcastMessage(SpaceUpdateUserStatistics.Compose(actor, 4), 0, false); instanceBySpaceId.BroadcastMessage(SpaceUpdateUserStatistics.Compose(actor2, 4), 0, false); actor.Lock(20, true, false); actor2.Lock(20, true, false); instanceBySpaceId.BroadcastMessage(SpaceUserSendUppercut.Compose(actor, actor2), 0, false); } } } } }
public void Whisper(string MessageText, uint TargetUserId, bool CanOverridespaceMute = false) { CharacterInfo info = (CharacterInfo)this.object_0; ServerMessage message = SpaceChatComposer.Compose(this.uint_0, MessageText, (info.Staff == 1) ? 2 : 1, ChatType.Whisper); if (this.spaceActorType_0 == SpaceActorType.UserCharacter) { Session sessionByCharacterId = SessionManager.GetSessionByCharacterId(this.uint_1); if (sessionByCharacterId != null) { sessionByCharacterId.SendData(message); } } if (TargetUserId != this.uint_1) { SpaceActor actorByReferenceId = this.spaceInstance_0.GetActorByReferenceId(TargetUserId, SpaceActorType.UserCharacter); if ((actorByReferenceId != null) && (actorByReferenceId.Type == SpaceActorType.UserCharacter)) { Session session2 = SessionManager.GetSessionByCharacterId(actorByReferenceId.ReferenceId); if ((session2 != null) && !session2.IgnoreCache.UserIsIgnored(this.uint_1)) { session2.SendData(message); } } } }
public void UpdateActorStatus(SpaceActor Actor) { Vector2 vector = this.vector2_0[Actor.Position.Int32_0, Actor.Position.Int32_1]; if (vector != null) { Actor.Position = new Vector3(vector.Int32_0, vector.Int32_1, Actor.Rotation); } }
private static void smethod_20(Session session_0, ClientMessage clientMessage_0) { uint itemId = clientMessage_0.ReadUnsignedInteger(); SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(session_0.CurrentSpaceId); if (instanceBySpaceId != null) { SpaceActor actorByReferenceId = instanceBySpaceId.GetActorByReferenceId(session_0.CharacterId, SpaceActorType.UserCharacter); if (actorByReferenceId != null) { CharacterInfo referenceObject = (CharacterInfo)actorByReferenceId.ReferenceObject; try { ContestItem item = instanceBySpaceId.Items[itemId]; if ((item != null) && item.IsActive) { using (SqlDatabaseClient client = SqlDatabaseManager.GetClient()) { item.CatchItem(client, (int)session_0.CharacterId); string definitionName = item.DefinitionName; if (definitionName != null) { if (definitionName != "cofre_oro") { if (!(definitionName == "cofre_plata")) { if (definitionName == "") { instanceBySpaceId.BroadcastChatMessage(actorByReferenceId, actorByReferenceId.Name + " ha atrapado un moco sanguinolento.", false, 3); } } else { instanceBySpaceId.BroadcastChatMessage(actorByReferenceId, string.Concat(new object[] { actorByReferenceId.Name, " has opened chest and received: ", item.SilverCredits, " silver credits" }), false, 3); referenceObject.UpdateSilverCreditsBalance(client, (int)item.SilverCredits); session_0.SendData(CharacterCoinsComposer.AddSilverCompose(item.SilverCredits)); } } else { instanceBySpaceId.BroadcastChatMessage(actorByReferenceId, string.Concat(new object[] { actorByReferenceId.Name, " has opened chest and received: ", item.GoldCredits, " gold credits" }), false, 3); referenceObject.UpdateGoldCreditsBalance(client, (int)item.GoldCredits); session_0.SendData(CharacterCoinsComposer.AddGoldCompose(item.GoldCredits)); } } } instanceBySpaceId.BroadcastMessage(SpaceCatchItemComposer.Compose(itemId), 0, false); instanceBySpaceId.BroadcastMessage(SpaceRemoveItemComposer.Compose(itemId), 0, false); } } catch (Exception) { } } } }
public void KickUser(uint UserId) { SpaceActor actorByReferenceId = this.GetActorByReferenceId(UserId, SpaceActorType.UserCharacter); if ((actorByReferenceId != null) && (actorByReferenceId.Type == SpaceActorType.UserCharacter)) { SpaceManager.RemoveUserFromSpace(SessionManager.GetSessionByCharacterId(actorByReferenceId.ReferenceId), true); this.RemoveCharacterFromSpace(UserId); } }
private static void smethod_3(Session session_0, ClientMessage clientMessage_0) { SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(session_0.CurrentSpaceId); if (instanceBySpaceId != null) { SpaceActor actorByReferenceId = instanceBySpaceId.GetActorByReferenceId(session_0.CharacterId, SpaceActorType.UserCharacter); if ((actorByReferenceId != null) && !actorByReferenceId.IsLocked) { SpaceManager.RemoveUserFromSpace(session_0, true); } } }
private static void smethod_7(Session session_0, ClientMessage clientMessage_0) { clientMessage_0.ReadUnsignedInteger(); int rotation = clientMessage_0.ReadInteger(); SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(session_0.CurrentSpaceId); if (instanceBySpaceId != null) { SpaceActor actorByReferenceId = instanceBySpaceId.GetActorByReferenceId(session_0.CharacterId, SpaceActorType.UserCharacter); if ((actorByReferenceId != null) && !actorByReferenceId.IsLocked) { instanceBySpaceId.BroadcastMessage(SpaceUserRotationComposer.Compose(actorByReferenceId.UInt32_0, actorByReferenceId.Position.Int32_0, actorByReferenceId.Position.Int32_1, rotation), 0, 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()); } } }
private static void smethod_5(Session session_0, ClientMessage clientMessage_0) { clientMessage_0.ReadUnsignedInteger(); uint actionId = clientMessage_0.ReadUnsignedInteger(); SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(session_0.CurrentSpaceId); if (instanceBySpaceId != null) { SpaceActor actorByReferenceId = instanceBySpaceId.GetActorByReferenceId(session_0.CharacterId, SpaceActorType.UserCharacter); if ((actorByReferenceId != null) && !actorByReferenceId.IsPreLocked) { actorByReferenceId.PreLock(2); instanceBySpaceId.BroadcastMessage(SpaceUserActionComposer.Compose(session_0.CharacterId, actionId), 0, false); } } }
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); } }
public void BroadcastChatMessage(SpaceActor Actor, string MessageText, bool Whisper, int MessageColor) { lock (this.object_1) { foreach (SpaceActor actor in this.concurrentDictionary_0.Values) { ServerMessage message = SpaceChatComposer.Compose(Actor.UInt32_0, MessageText, MessageColor, Whisper ? ChatType.Whisper : ChatType.Say); if (actor.Type == SpaceActorType.UserCharacter) { Session sessionByCharacterId = SessionManager.GetSessionByCharacterId(actor.ReferenceId); if ((sessionByCharacterId != null) && ((Actor.Type != SpaceActorType.UserCharacter) || !sessionByCharacterId.IgnoreCache.UserIsIgnored(Actor.ReferenceId))) { sessionByCharacterId.SendData(message); } } } } }
public bool RemoveActorFromSpace(uint ActorId) { bool flag = false; lock (this.object_1) { if (this.GetActor(ActorId) == null) { return(false); } SpaceActor actor2 = null; if (flag = this.concurrentDictionary_0.TryRemove(ActorId, out actor2)) { this.BroadcastMessage(SpaceUserRemovedComposer.BroadcastCompose(ActorId), 0, false); this.MarkActorCountSyncNeeded(); } } return(flag); }
private static void smethod_14(Session session_0, ClientMessage clientMessage_0) { clientMessage_0.ReadUnsignedInteger(); uint actorId = clientMessage_0.ReadUnsignedInteger(); SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(session_0.CurrentSpaceId); if (instanceBySpaceId != null) { SpaceActor actorByReferenceId = instanceBySpaceId.GetActorByReferenceId(session_0.CharacterId, SpaceActorType.UserCharacter); SpaceActor actor = instanceBySpaceId.GetActor(actorId); if ((actor != null) && (actorByReferenceId != null)) { Session sessionByCharacterId = SessionManager.GetSessionByCharacterId(actor.ReferenceId); if (sessionByCharacterId != null) { sessionByCharacterId.SendData(SpaceUserCancelActionComposer.TargetCompose(actorByReferenceId.UInt32_0)); } } } }
private static void smethod_17(Session session_0, ClientMessage clientMessage_0) { clientMessage_0.ReadUnsignedInteger(); string motto = clientMessage_0.ReadString(); SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(session_0.CurrentSpaceId); if (instanceBySpaceId != null) { SpaceActor actorByReferenceId = instanceBySpaceId.GetActorByReferenceId(session_0.CharacterId, SpaceActorType.UserCharacter); if (actorByReferenceId != null) { CharacterInfo referenceObject = (CharacterInfo)actorByReferenceId.ReferenceObject; using (SqlDatabaseClient client = SqlDatabaseManager.GetClient()) { referenceObject.UpdateMotto(client, motto); } instanceBySpaceId.BroadcastMessage(SpaceUserMottoUpdateComposer.Compose(actorByReferenceId.UInt32_0, motto), 0, false); } } }
private static void smethod_10(Session session_0, ClientMessage clientMessage_0) { uint actorId = clientMessage_0.ReadUnsignedInteger(); uint colorId = clientMessage_0.ReadUnsignedInteger(); int vote = clientMessage_0.ReadInteger(); SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(session_0.CurrentSpaceId); if (instanceBySpaceId != null) { SpaceActor actorByReferenceId = instanceBySpaceId.GetActorByReferenceId(session_0.CharacterId, SpaceActorType.UserCharacter); if (actorByReferenceId != null) { CharacterInfo referenceObject = (CharacterInfo)actorByReferenceId.ReferenceObject; using (SqlDatabaseClient client = SqlDatabaseManager.GetClient()) { referenceObject.UpdateVotes(client, colorId, vote); } instanceBySpaceId.BroadcastMessage(SpaceUserVoteUpdateComposer.Compose(actorId, colorId, vote), 0, false); } } }
private static void smethod_4(Session session_0, ClientMessage clientMessage_0) { try { SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(session_0.CurrentSpaceId); if (instanceBySpaceId != null) { SpaceActor actorByReferenceId = instanceBySpaceId.GetActorByReferenceId(session_0.CharacterId, SpaceActorType.UserCharacter); if ((actorByReferenceId != null) && !actorByReferenceId.IsLocked) { clientMessage_0.ReadUnsignedInteger(); string str = clientMessage_0.ReadString(); string str2 = str; List <Vector3> stepList = new List <Vector3>(); while (str2 != "") { stepList.Add(new Vector3(int.Parse(str2.Substring(0, 2)), int.Parse(str2.Substring(2, 2)), int.Parse(str2.Substring(4, 1)))); str2 = str2.Substring(5); } Vector3 toPosition = new Vector3(int.Parse(str.Substring(str.Length - 5, 2)), int.Parse(str.Substring(str.Length - 3, 2)), int.Parse(str.Substring(str.Length - 1, 1))); actorByReferenceId.MoveTo(stepList, toPosition, false, false, false); } else { Console.WriteLine("BLoqueado"); } } else { Console.WriteLine("No hay instanceid"); } } catch (Exception e) { Console.WriteLine(e.ToString()); } }
private static void smethod_12(Session session_0, ClientMessage clientMessage_0) { uint actionId = clientMessage_0.ReadUnsignedInteger(); uint actorId = clientMessage_0.ReadUnsignedInteger(); SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(session_0.CurrentSpaceId); if (instanceBySpaceId == null) { return; } SpaceActor actorByReferenceId = instanceBySpaceId.GetActorByReferenceId(session_0.CharacterId, SpaceActorType.UserCharacter); SpaceActor actor = instanceBySpaceId.GetActor(actorId); if ((actor == null) || (actorByReferenceId == null)) { return; } CharacterInfo referenceObject = (CharacterInfo)actorByReferenceId.ReferenceObject; CharacterInfo info2 = (CharacterInfo)actor.ReferenceObject; if (actorByReferenceId.IsLocked || actor.IsLocked) { return; } actorByReferenceId.StopMoving(); actor.StopMoving(); if (SessionManager.GetSessionByCharacterId(actor.ReferenceId) == null) { return; } using (SqlDatabaseClient client = SqlDatabaseManager.GetClient()) { switch (actionId) { case 1: referenceObject.UpdateKisses(client, false); info2.UpdateKisses(client, true); actor.Lock(3, false, false); actorByReferenceId.Lock(3, false, false); goto Label_0165; case 2: referenceObject.UpdateCocktails(client, false); info2.UpdateCocktails(client, true); actor.Lock(9, false, false); actorByReferenceId.Lock(9, false, false); goto Label_0165; case 3: referenceObject.UpdateRoses(client, false); info2.UpdateRoses(client, true); actor.Lock(4, false, false); actorByReferenceId.Lock(4, false, false); goto Label_0165; } referenceObject.UpdateKisses(client, false); info2.UpdateKisses(client, true); actor.Lock(3, false, false); actorByReferenceId.Lock(3, false, false); } Label_0165: instanceBySpaceId.BroadcastMessage(SpaceUpdateUserStatistics.Compose(actorByReferenceId, actionId), 0, false); instanceBySpaceId.BroadcastMessage(SpaceUpdateUserStatistics.Compose(actor, actionId), 0, false); instanceBySpaceId.BroadcastMessage(SpaceUserAcceptInteract.Compose(actor, actorByReferenceId, actionId), 0, false); }