internal Bully(UInt32 reporterId, UInt32 reportedId, List <ChatMessage> _conversation) { this.ReporterId = reporterId; this.ReportedId = reportedId; this.GuardianId = 0; this.nullGuardians = new List <UInt32>(); this.startedTimer = DateTime.Now; this.bullyState = BullyState.SEARCHING_USER; this.bullySolution = BullySolution.NONE; this.conversation = _conversation; this.AlfaChatLog = ""; }
internal void SerializeAlfaChat() { GameClient _Guardian = Guardian; if (_Guardian == null) { this.bullySolution = BullySolution.EXIT; this.bullyState = BullyState.FINISHED; return; } StringBuilder strBuilder = new StringBuilder(); Dictionary <UInt32, Int32> usersIds = new Dictionary <uint, int>(); usersIds.Add(ReportedId, 0); foreach (ChatMessage chatMessage in this.conversation) { int i = usersIds.Count; if (usersIds.ContainsKey(chatMessage.userID)) { i = usersIds[chatMessage.userID]; } else { usersIds.Add(chatMessage.userID, i); } strBuilder.Append(chatMessage.timeSpoken + ";" + i + ";" + chatMessage.message + Convert.ToChar(13)); } this.AlfaChatLog = strBuilder.ToString(); ServerMessage Message = new ServerMessage(Outgoing.GetAlfaMessages); Message.AppendInt32(60); // seconds. Message.AppendString(strBuilder.ToString()); _Guardian.SendMessage(Message); }
internal void OnCycle() { if (this.bullyState == BullyState.SEARCHING_USER) { if ((DateTime.Now - customTimer).Seconds >= 15) { GameClient guardianClient = OtanixEnvironment.GetGame().GetClientManager().GetClientByUserID(this.GuardianId); if (guardianClient != null) { ServerMessage Message3 = new ServerMessage(Outgoing.CancelAlfaAlert); guardianClient.SendMessage(Message3); guardianClient.GetHabbo().AlfaServiceId = 0; guardianClient.GetHabbo().ExitAlfaState(); } if (!this.nullGuardians.Contains(this.GuardianId)) { this.nullGuardians.Add(this.GuardianId); } if (!this.SearchGuardian()) { this.SerializeNoGuardians(); OtanixEnvironment.GetGame().GetAlfaManager().GetBullyManager().RemoveBullie(this.ReporterId); return; } } else if (this.NeedUpdate) { this.NeedUpdate = false; if (!this.nullGuardians.Contains(this.GuardianId)) { this.nullGuardians.Add(this.GuardianId); } if (!this.SearchGuardian()) { this.SerializeNoGuardians(); OtanixEnvironment.GetGame().GetAlfaManager().GetBullyManager().RemoveBullie(this.ReporterId); return; } } } else if (this.bullyState == BullyState.WAITING_RESPONSE) { if ((DateTime.Now - customTimer).Seconds >= 59) { GameClient guardianClient = Guardian; if (guardianClient != null) { ServerMessage Message3 = new ServerMessage(Outgoing.CancelAlfaAlert); guardianClient.SendMessage(Message3); } this.bullySolution = BullySolution.EXIT; this.bullyState = BullyState.FINISHED; } } else if (this.bullyState == BullyState.FINISHED) { switch (this.bullySolution) { case BullySolution.NONE: case BullySolution.EXIT: case BullySolution.RELOAD: { GameClient _Reporter = Reporter; if (_Reporter != null) { OtanixEnvironment.GetGame().GetModerationTool().SendNewTicket(_Reporter, 104, (int)ReportedId, "Acoso", new string[0]); } break; } case BullySolution.ACCEPTABLE: { // none (: break; } case BullySolution.BULLY: case BullySolution.HORROR: { Habbo habbo = UsersCache.getHabboCache(ReportedId); if (habbo == null) { return; } ModerationTool.MuteUser(null, habbo, 10, ""); break; } /*case BullySolution.HORROR: * { * GameClient TargetClient = OtanixEnvironment.GetGame().GetClientManager().GetClientByUserID(ReportedId); * Habbo habbo = UsersCache.getHabboCache(ReportedId); * * if (habbo != null && habbo.Rank <= 1) * //OtanixEnvironment.GetGame().GetBanManager().BanUser(TargetClient, habbo.Username, "", "Baneado por los HabboAlfas.", 21600, null); * break; * }*/ } GameClient guardianClient = Guardian; if (guardianClient != null && guardianClient.GetHabbo() != null) { guardianClient.GetHabbo().AlfaServiceId = 0; guardianClient.GetHabbo().AlfaHelpEnabled = false; if (bullySolution == BullySolution.ACCEPTABLE || bullySolution == BullySolution.BULLY || bullySolution == BullySolution.HORROR) { ServerMessage EndVotation = new ServerMessage(Outgoing.FinishAlfaVotation); EndVotation.AppendInt32((Int32)bullySolution); EndVotation.AppendInt32((Int32)bullySolution); EndVotation.AppendInt32(0); // array guardianClient.SendMessage(EndVotation); } // Con esto enviaremos al Guardián al inicio de la lista para que puedan ayudar los últimos guardianes. // OtanixEnvironment.GetGame().GetAlfaManager().GetBullyManager().RemoveGuardian(GuardianId); // OtanixEnvironment.GetGame().GetAlfaManager().GetBullyManager().AddGuardian(GuardianId); } if (this.AlfaChatLog.Length > 0) { OtanixEnvironment.GetGame().GetAlfaManager().LoadAlfaLog(this.GuardianId, "BULLY", this.AlfaChatLog, (Int32)this.bullySolution); } OtanixEnvironment.GetGame().GetAchievementManager().ProgressUserAchievement(GuardianId, "ACH_GuideChatReviewer", 1); GameClient reporterClient = Reporter; if (reporterClient != null) { ServerMessage reporterAlert = new ServerMessage(Outgoing.ResolvedAlfa); reporterAlert.AppendInt32(3); reporterClient.SendMessage(reporterAlert); } OtanixEnvironment.GetGame().GetAlfaManager().GetBullyManager().RemoveBullie(this.ReporterId); } }