public (List <GuardianVote> Votes, GuardianVote MyVote) GetVotes(GameClient sesison) { List <GuardianVote> votes = new List <GuardianVote>(); GuardianVote myVote = GuardianVote.Waiting; IEnumerator <KeyValuePair <uint, GuardianVote> > votes_ = this.GuardianVotes.GetEnumerator(); for (int i = 0; i < Math.Max(BullyReport.MinVotes, this.GuardianVotes.Count); i++) { if (votes_.MoveNext()) { if (votes_.Current.Key != sesison.GetHabbo().ID) { votes.Add(votes_.Current.Value); } else { myVote = votes_.Current.Value; } } else { votes.Add(GuardianVote.Searching); } } return(votes, myVote); }
public void Vote(GameClient session, GuardianVote type) { if (this.BusyGuides.TryGetValue(session.GetHabbo().ID, out GuideRequest report)) { (report as BullyReport)?.Vote(session, type); } }
public void Vote(GameClient session, GuardianVote type) { if (this.GuardianVotes.TryUpdate(session.GetHabbo().ID, type, GuardianVote.Waiting)) { this.Guardians[session.GetHabbo().ID] = double.MaxValue; this.UpdateVotes(); } }
public BullyReportResultsComposerHandler(GuardianVote verdict, GuardianVote yourVote, List <GuardianVote> votes) { this.Verdict = verdict; this.YourVote = yourVote; this.Votes = votes; }
public bool TryFinish() { if (this.Time >= BullyReport.VoteTime) { if (this.GuardianVotes.Count >= BullyReport.MinVotes) { GuardianVote verdict = this.VerdictCalc(); GuardianVote verdictDisplay = GuardianVote.Forwarded; if (verdict == GuardianVote.Acceptably) { verdictDisplay = GuardianVote.Acceptably; Skylight.GetGame().GetGuideManager().ActivateBullyReportAbuseTimeout(this.ReporterID); } else if (verdict == GuardianVote.Badly) { verdictDisplay = GuardianVote.Badly; double expires = TimeUtilies.GetUnixTimestamp() + BullyReport.MuteTime; using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient()) { dbClient.AddParamWithValue("muteExpires", expires); dbClient.AddParamWithValue("targetId", this.ReportedID); dbClient.ExecuteQuery("UPDATE users SET mute_expires = @muteExpires WHERE id = @targetId LIMIT 1"); } GameClient session = Skylight.GetGame().GetGameClientManager().GetGameClientById(this.ReportedID); if (session != null) { session.GetHabbo().MuteExpires = expires; session.SendMessage(OutgoingPacketsEnum.Flood, new ValueHolder("TimeLeft", session.GetHabbo().MuteTimeLeft())); } } else { verdictDisplay = GuardianVote.Forwarded; //send to mod } foreach (KeyValuePair <uint, GuardianVote> vote in this.GuardianVotes) { if (this.Guardians.ContainsKey(vote.Key)) { GameClient session = Skylight.GetGame().GetGameClientManager().GetGameClientById(vote.Key); if (session != null) { (List <GuardianVote> votes, GuardianVote myVote) = this.GetVotes(session); session.SendMessage(new BullyReportResultsComposerHandler(verdictDisplay, myVote, votes)); } } } Skylight.GetGame().GetGameClientManager().GetGameClientById(this.ReporterID)?.SendMessage(new BullyReportCloseComposerHandler(verdict != GuardianVote.Acceptably)); } else { //send to mod foreach (KeyValuePair <uint, GuardianVote> vote in this.GuardianVotes) { if (this.Guardians.ContainsKey(vote.Key)) { GameClient session = Skylight.GetGame().GetGameClientManager().GetGameClientById(vote.Key); if (session != null) { (List <GuardianVote> votes, GuardianVote myVote) = this.GetVotes(session); session.SendMessage(new BullyReportResultsComposerHandler(GuardianVote.Forwarded, myVote, votes)); } } } Skylight.GetGame().GetGameClientManager().GetGameClientById(this.ReporterID)?.SendMessage(new BullyReportCloseComposerHandler(true)); } return(true); } else { return(false); } }