Talk:Player Rank

From Granblue Fantasy Wiki
Jump to: navigation, search

Rank Table Update Script[edit]

#!/usr/bin/env ruby

# Add new data here
next_rp_for_rank = {
    1 => 50, 2 => 150, 3 => 300, 4 => 400,
    5 => 600, 6 => 700, 7 => 700, 8 => 900, 9 => 1100,
    10 => 1600, 11 => 1500, 12 => 1600, 13 => 1900, 14 => 2000,
    15 => 2100, 16 => 2200, 17 => 2300, 18 => 2850, 19 => 3550,
    20 => 3950, 21 => 4000, 22 => 4450, 23 => 4950, 24 => 5500,
    25 => 6100, 26 => 6750, 27 => 7450, 28 => 8200, 29 => 9000,
    30 => 9850, 31 => 10750, 32 => 11700, 33 => 12700, 34 => 13750,
    35 => 14850, 36 => 16000, 37 => 17200, 38 => 18450, 39 => 19750,
    40 => 21100, 41 => 22500, 42 => 23950, 43 => 25450, 44 => 27000,
    45 => 28600, 46 => 30250, 47 => 31950, 48 => 33700, 49 => 35500,
    50 => 37350, 51 => 39250, 52 => 41200, 53 => 43200, 54 => 45250,
    55 => 47350, 56 => 49500, 57 => 51700, 58 => 53950, 59 => 56250,
    60 => 58600, 61 => 61000, 62 => 63450, 63 => 65950, 64 => 68500,
    65 => 71100, 66 => 73750, 67 => 76450, 68 => 79200, 69 => 82000,
    70 => 84850, 71 => 87750, 72 => 90700, 73 => 93700, 74 => 96750,
    75 => 99850, 76 => 103000, 77 => 106200, 78 => 109450, 79 => 112750,
    80 => 116100, 81 => 119500, 82 => 122950, 83 => 126450, 84 => 130000,
    85 => 133600, 86 => 137250, 87 => 140950, 88 => 144700, 89 => 148500,
    90 => 152350, 91 => 156250, 92 => 160200, 93 => 164200, 94 => 168250,
    95 => 172350, 96 => 176500, 97 => 180700, 98 => 184950, 99 => 189250,
    100 => 250000, 101 => 260150, 102 => 270400, 103 => 280900, 104 => 291600,
    105 => 302500, 106 => 313600, 107 => 324900, 108 => 336400, 109 => 348100,
    110 => 360000, 111 => 372100, 112 => 384400, 113 => 396900, 114 => 409600,
    115 => 422500, 116 => 435600, 117 => 448900, 118 => 462400, 119 => 476100,
    120 => 490000, 121 => 504100, 122 => 518400, 123 => 532900, 124 => 547600,
    125 => 562500, 126 => 577600, 127 => 592900, 128 => 608400, 129 => 624100,
    130 => 640000, 131 => 656200, 132 => 672700, 133 => 689500, 134 => 706600,
    135 => 724000, 136 => 741000, 137 => 759700, 138 => 778000, 139 => 796600,
    140 => 815500, 141 => 834700, 142 => 854200, 143 => 874000, 144 => 894000,
    145 => 914400, 146 => 935200, 147 => 956400, 148 => 978000, 149 => 1000000,
    150 => 1022500, 151 => 1048500, 152 => 1072000, 153 => 1099000, 154 => 1128000,
    155 => 1158500, 156 => 1195000, 157 => 1235000, 158 => 1280000, 159 => 1330000,
    160 => 1390000, 161 => 1460000, 162 => 1540000, 163 => 1630000, 164 => 1730000,
    165 => 1850000, 166 => 1990000, 167 => 2150000, 168 => 2330000, 169 => 2530000,
    170 => 2750000, 171 => 3010000, 172 => 3280000, 173 => 3550000, 174 => 3905000,
}

# Assuming ordered Ruby 1.9 hashes here
rp_sum = 0
total_rp_for_rank = [0, 0] + next_rp_for_rank.values.map { |rp|
    rp_sum += rp
    rp_sum
}

def separate_thousands(n)
    n.to_s.gsub(/(\d)(?=(\d\d\d)+(?!\d))/, "\\1,")
end

puts DATA.read.gsub(%r{^\|([0-9]+)\|\|[^|]*\|\|[^|]*\|\|}) { |s|
    rank = Regexp.last_match[1].to_i
    rp = next_rp_for_rank[rank]
    total_rp = if rank == 1 then '-' else total_rp_for_rank[rank] end
    if rp.nil?
        s
    else
        "|#{rank}||#{separate_thousands(rp)}||#{separate_thousands(total_rp)}||"
    end
}

# Paste the current wiki table after the __END__ line.
__END__
|-
|1||50||-||10||20
...
|-
|175|| || || ||