Open-source multiplayer game server compatible with the RuneScape client
https://www.openrs2.org/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
420 B
21 lines
420 B
var buildRegex = new RegExp('>([0-9]+)(?:[.]([0-9]+))?<');
|
|
|
|
function buildSort(a, b) {
|
|
a = buildRegex.exec(a);
|
|
b = buildRegex.exec(b);
|
|
if (!a) {
|
|
return -1;
|
|
} else if (!b) {
|
|
return 1;
|
|
}
|
|
|
|
var aMajor = parseInt(a[1]);
|
|
var bMajor = parseInt(b[1]);
|
|
if (aMajor !== bMajor) {
|
|
return aMajor - bMajor;
|
|
}
|
|
|
|
var aMinor = a[2] ? parseInt(a[2]) : 0;
|
|
var bMinor = b[2] ? parseInt(b[2]) : 0;
|
|
return aMinor - bMinor;
|
|
}
|
|
|