-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.fs
96 lines (73 loc) · 2.9 KB
/
Program.fs
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
namespace WowLogScan
open WowLogScan.ProgramState
module Main =
open FParsec
open WowLogScan
open EventLog
open ScanUnits
let printUnknownEvents logLines =
for ev in logLines do
match ev with
| CombatLogEvent.NotSupported _ -> printfn "%A" ev
| _ -> ()
let handleParsedList astEvents =
let events =
astEvents
|> List.mapi (fun index v -> Parser.createEvent (v, index))
// Parse unit ids and match to player names
let raid = scanUnits astEvents
// Parse world buffs gained/lost for raid prep/contribution
if true then
printfn ""
printfn "# WORLD BUFFS (raid prep) ---"
printfn "# The scoring rules: "
ScanBuffs.printScoringRules
printfn ""
let worldBuffsReport = ScanBuffs.scanWorldBuffs (raid, events)
for wb in worldBuffsReport do
match wb.Key with
| TargetType.Player p -> printfn "%A %A" p wb.Value
| _ -> ()
// Print CSV
for wb in worldBuffsReport do
match wb.Key with
| TargetType.Player p ->
let effortScore = EffortScore.scoreWorldBuffs (wb.Value)
if effortScore > 0 then printfn "%s,%d,Worldbuff" p effortScore
| _ -> ()
if false then
printfn ""
printfn "# ENCOUNTER START BUFFS ---"
printfn "# List recognized consumable effects up on the combatants when an encounter starts"
printfn "# The scoring rules: "
ScanCombatStart.printScoringRules
printfn ""
let combatantBuffReport = ScanCombatStart.scan (raid, events)
for cr in combatantBuffReport do
ScanCombatStart.printReport (raid, cr)
if true then
printfn ""
printfn "# CONSUMABLES IN COMBAT (raid prep) ---"
printfn "# List recognized consumable effects used throughout the raid"
printfn ""
let consumReport =
ScanConsumablesInCombat.scan (raid, events)
ScanConsumablesInCombat.printReport consumReport
ScanConsumablesInCombat.printEffortPoints consumReport
if true then
printfn ""
printfn "# ENCHANTED GEAR (raid prep) ---"
printfn "# Listed are all unique items used by players in the raid, with permanent enchants"
printfn "# Temporary enchant data like oils, poisons and totem effects is available but not analyzed"
printfn ""
let enchantsReport = ScanEnchants.scanEnchants (raid, events)
for er in enchantsReport do
printfn "%s" (ScanEnchants.printReport er)
[<EntryPoint>]
let main (argv: string []): int =
let filename = argv.[0]
Global.RealmName <- argv.[1]
match CharParsers.runParserOnFile CombatlogSyntax.combatLogEventList () filename System.Text.Encoding.UTF8 with
| Success (parsedList, _, _) -> handleParsedList parsedList |> ignore
| Failure (err, _, _) -> printfn "Fail: %s" err
0