sc: option to order by speed
[sheet.git] / sc.plp
diff --git a/sc.plp b/sc.plp
index a721035d215ad2c3ec9a93744b3aa66548efb6dc..8f512164cc4c8a1ab0bcb34d38c3f7f84389b42e 100644 (file)
--- a/sc.plp
+++ b/sc.plp
@@ -105,7 +105,7 @@ sub coltoggle {
        <th class="hurt hurtrel">dps</th>
        <th class="val unit-range" colspan=3>range</th>
        <th class="val unit-sight">sight</th>
-       <th class="val unit-speed">speed</th>
+       <th class="val unit-speed"><:= coltoggle(speed => 'speed') :></th>
        <th class="unit-magic">specials</th>
 </tr></thead>
 <:
@@ -370,6 +370,12 @@ sub showrangeint {
                                } @{ $_->{attack} }
                        ) for @rows;
                }
+               elsif ($get{order} eq 'speed') {
+                       $_->{order} = (
+                               ($_->{upgraded}->{speed} // $_->{speed}*1.01)
+                               + $_->{sight}/1024 + $_->{detect}/2048
+                       ) for @rows;
+               }
                @rows = sort {$a->{order} <=> $b->{order}} @rows if exists $rows[0]->{order};
        }