-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
125 lines (103 loc) · 5.09 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using LiteDB;
namespace fallguyslevelchances
{
public class Program
{
private static Dictionary<String, String> roundNames = new Dictionary<String, String> {
{ "round_door_dash" , "Door Dash" },
{ "round_gauntlet_02" , "Dizzy Heights" },
{ "round_dodge_fall" , "Fruit Chute" },
{ "round_chompchomp" , "Gate Crash" },
{ "round_gauntlet_01" , "Hit Parade" },
{ "round_see_saw" , "See Saw" },
{ "round_lava" , "Slime Climb" },
{ "round_tip_toe" , "Tip Toe" },
{ "round_gauntlet_03" , "Whirlygig" },
{ "round_gauntlet_04", "Knight Fever" },
{ "round_wall_guys", "Wall Guys" },
{ "round_hoops_blockade_solo" , "Hoopsie Legends"},
{ "round_block_party" , "Block Party"},
{ "round_jump_club" , "Jump Club"},
{ "round_match_fall" , "Perfect Match"},
{ "round_tunnel" , "Roll Out" },
{ "round_tail_tag" , "Tail Tag" },
{ "round_egg_grab" , "Egg Scramble" },
{ "round_fall_ball_60_players" , "Fall Ball"} ,
{ "round_ballhogs" , "Hoarders" } ,
{ "round_hoops" , "Hoopsie Daisy" } ,
{ "round_jinxed" , "Jinxed" } ,
{ "round_rocknroll" , "Rock'n'Roll" } ,
{ "round_conveyor_arena" , "Team Tail Tag" } ,
{ "round_egg_grab_02" , "Egg Siege" } ,
{ "round_fall_mountain_hub_complete" , "RNG Mountain" } ,
{ "round_floor_fall" , "Hex-a-Gone" } ,
{ "round_jump_showdown" , "Jump Showdown" } ,
{ "round_royal_rumble" , "Royal Fumble" }
};
public class RoundInfo {
public LiteDB.ObjectId Id { get; set; }
public string Name { get; set; }
public int Players { get; set; }
public int ShowID {get; set; }
public int Round {get; set; }
public Boolean InParty {get; set; }
public int Position {get; set;}
public int Tier { get; set; }
public override string ToString()
{
return string.Format("Id : {0}, Name : {1}, Players : {2}",
Id,
Name,
Players);
}
}
static void Main(string[] args)
{
System.IO.File.Copy(@"C:\Users\coope\Downloads\FallGuyStats\data.db", @"data-temp.db", true);
using(var db = new LiteDatabase(@"data-temp.db"))
{
Console.WriteLine("Please insert a numerical value 1-60.");
var numinput = 0;
bool numFound = false;
while (numFound == false) {
try {
numinput = int.Parse(Console.ReadLine());
} catch(FormatException) {
Console.Write("Please insert a numerical value.");
}
if (numinput < 1 || numinput > 60) {
Console.Write("Value must be between 1-60.");
} else {
numFound = true;
}
}
// Get customer collection
var RoundDetails = db.GetCollection<RoundInfo>("RoundDetails");
var countQuery = RoundDetails.Find(x => x.Players == numinput).Count();
Console.WriteLine("Total Count: " + countQuery);
Dictionary<string, int> roundDetailsDictUnsorted = new Dictionary<string, int>();
foreach(KeyValuePair<string, string> entry in roundNames) {
var query = RoundDetails
.Find(x => x.Players == numinput && x.Name.Contains(entry.Key));
if (query.Count() != 0) {
roundDetailsDictUnsorted.Add(entry.Value, query.Count());
}
}
Dictionary<string, int> roundDetailsDictSorted = new Dictionary<string, int>(from entry in roundDetailsDictUnsorted orderby entry.Value descending select entry);
//var roundDetailsDictSorted = from entry in roundDetailsDictUnsorted orderby entry.Value descending select entry;
foreach(KeyValuePair<string, int> entry in roundDetailsDictSorted) {
float percentage = (float)entry.Value / (float)countQuery * 100;
Console.WriteLine(entry.Key + ": " + entry.Value + " times, " + Math.Round(percentage, 2) + "%");
}
if (countQuery == 0) {
Console.WriteLine("Sorry, no results were found for that number of players.");
}
}
System.IO.File.Delete(@"data-temp.db");
}
}
}