Wmo Calculater



前言

wmo 並沒有加總某次的 Naxx 全程boss戰總傷以及有效治療
所以用 perl 寫了一個小 parser 去算,寫的超級醜…(沒辦法清晨寫的 Orz)

CODE

#!/usr/bin/env perl
 
use LWP::Simple;
use strict;
use warnings;
 
my $html;
my $record;
my %totaldamage;
my %effheal;
my $key;
my $value;
my $url;
my @dmgwinner;
my @healwinner;
my $second;
 
sub by_damage  { $totaldamage{$b} <=> $totaldamage{$a} }
sub by_effheal { $effheal{$b} <=> $effheal{$a} }
 
$| = 1; #把 buffer 設置成autoflush模式,因為它會等buffer滿了或程序結束了才一次flush出來
for ( $record = $ARGV[0] ; $record < $ARGV[0] + 15 ; $record++ ) {
    $url = "http://wmo.178.com/combat/$record";
    $second = int(rand(6)); # random wait for 0~5 seconds
 
    print "processing $url...";
    $html = get("$url");
 
    if ( !$html ) {
        print "connection error\n";
        return;
    }
 
    $html =~ s/\r|\n//g;
 
    while ( $html =~
m{"actorname": "(\S+)", "damagepercent":\d\.\d+, "dps": \d+ , "combat_dps": \d+ , "totaldamage": (\d+)  , "classtype": "\S+" ,  "prespercent": "\d+" , "dpstimepercent": "\d+" , "idletime": "\d+\:\d+" , "idletimepercent": \d+ , "damagetaken" : \d+ , "damagetakenpercent" : \d+\.\d+ , "deaths" : \d+,  "deathstimestamps" : -?\d+ , "deathpercent":"\d+" ,"deathpercentnum": \d+,"ovheal" : \d+ ,"ovhealpercent" :\d+ , "hpstimepercent" : \d+ , "totalheal" : \d+ , "effheal" : (\d+)}
      )
    {
        $html = $';
 
    if ( !defined( $totaldamage{$1} ) ) {
            $totaldamage{$1} = $2;
        }
        else {
            $totaldamage{$1} += $2;
        }
 
        if ( !defined( $effheal{$1} ) ) {
            $effheal{$1} = $3;
        }
        else {
            $effheal{$1} += $3;
        }
    }
    print "done, wait $second s\n";
    sleep $second;
}
 
# sort total damage
@dmgwinner  = sort by_damage keys %totaldamage;
@healwinner = sort by_effheal keys %effheal;
open WMO, "> wmo.txt"
    or die "error create file: $!";
 
print "save information into wmo.txt...";
 
print WMO "================TOTAL DAMAGE=================\n";
foreach $key (@dmgwinner) {
    print WMO "$key: $totaldamage{$key}\n";
}
 
print WMO "================EFF HEAL=================\n";
foreach $key (@healwinner) {
    print WMO "$key: $effheal{$key}\n";
}
print "done\n";
close WMO;

OUTPUT

================TOTAL DAMAGE=================
黑暗之前: 13549364
舞雷: 13544520
挪威司機: 13393741
Liriano: 12961720
希爾黛斯: 12647748
Mayong: 12594885
黑泥冬: 11116784
紀念: 10928798
綠茶可爾必思: 9712191
迪路希: 8904747
鋼鏈: 8797945
Orzyasoul: 7809411
不愛游泳滴魚: 7531585
棒能普賽: 7200701
巖窟王: 7186142
Auomc: 6930155
風武: 6766588
淡菸: 5567256
肚邊: 2855704
廣藿香知識: 165006
棗真夜: 64327
牛牛舔八寶: 62380
芙璐夢: 55559
小夜衣: 41259
Cabart: 1469
================EFF HEAL=================
廣藿香知識: 6470244
Cabart: 5673347
小夜衣: 5041163
牛牛舔八寶: 4859687
棗真夜: 3195455
芙璐夢: 2503984
黑泥冬: 610377
Liriano: 461757
風武: 321606
淡菸: 280994
棒能普賽: 233875
舞雷: 229667
鋼鏈: 181182
黑暗之前: 176165
迪路希: 166474
希爾黛斯: 160299
綠茶可爾必思: 156557
Mayong: 149858
巖窟王: 126343
Orzyasoul: 123686
挪威司機: 102485
Auomc: 78470
不愛游泳滴魚: 77057
紀念: 68431
肚邊: 50259

下載

wmo.exe

用法

  • wmo.exe COMBAT_RECORD_ID

範例: wmo.exe 2874654

  • 搭配 wmo.bat(需和 wmo.exe 放在一起)

wmo.exe COMBAT_RECORD_ID
@pause

說明

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License