Skip to content

Commit 988772e

Browse files
committed
Version 0.0.3
1 parent 9e75ecd commit 988772e

File tree

3 files changed

+28
-6
lines changed

3 files changed

+28
-6
lines changed

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,21 @@ Repository to store signatures of the Tibia files
77
`7.10`, `7.30`, `7.40`, `7.50`, `7.55`, `7.60`, `7.70`, `7.80`, `7.90`, `7.92`, `8.00`, `8.10`, `8.11`, `8.20`, `8.30`, `8.40`, `8.41`, `8.42`, `8.50`, `8.52`, `8.53`, `8.54`, `8.55`, `8.60`, `8.61`, `8.62`, `8.70`, `8.71`, `8.72`, `9.00`, `9.10`, `9.20`, `9.40`, `9.44`, `9.46`, `9.50`, `9.52`, `9.53`, `9.54`, `9.60`, `9.61`, `9.63`, `9.70`, `9.80`, `9.81`, `9.82`, `9.83`, `9.85`, `9.86`, `10.10`, `10.20`, `10.21`, `10.30`, `10.31`, `10.32`, `10.34`, `10.35`, `10.36`, `10.37`, `10.38`, `10.39`, `10.40`, `10.41`, `10.50`, `10.51`, `10.52`, `10.53`, `10.54`, `10.55`
88

99
## API
10-
10+
* getSignatureByVersion(version)
11+
* version - required - Client Version without dots
12+
* returns Array or Object
13+
* getVersionBySprSignature(hexSign)
14+
* hexSign - required - First 4 bytes from Spr file
15+
* returns Integer
16+
* getVersionByDatSignature(hexSign)
17+
* hexSign - required - First 4 bytes reversed from Dat file
18+
* returns Integer
1119
* isValidSprSignature(hexSign)
12-
* hexSign - required - First 4 bytes from Spr file
20+
* hexSign - required - First 4 bytes from Spr file
21+
* return Boolean
1322
* isValidDatSignature(hexSign)
1423
* hexSign - required - First 4 bytes reversed from Dat file
24+
* return Boolean
1525

1626
## References
1727

index.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -384,19 +384,19 @@ clients = {
384384
}
385385
};
386386

387-
_findBy = function(type, value) {
387+
_findBy = function(type, value, returnVersion) {
388388
value = value.toUpperCase();
389389
for(var version in clients) {
390390
var client = clients[version];
391391
if(Array.isArray(client)) {
392392
for(var rev in client) {
393393
if(client[rev][type] == value) {
394-
return true;
394+
return (returnVersion) ? version : true;
395395
}
396396
}
397397
} else {
398398
if(client[type] == value) {
399-
return true;
399+
return (returnVersion) ? version : true;
400400
}
401401
}
402402
}
@@ -406,6 +406,18 @@ _findBy = function(type, value) {
406406

407407
module.exports = {
408408

409+
getSignatureByVersion: function(version) {
410+
return (version in clients) ? clients[version] : false;
411+
},
412+
413+
getVersionBySprSignature: function(value) {
414+
return _findBy('spr', value, true);
415+
},
416+
417+
getVersionByDatSignature: function(value) {
418+
return _findBy('dat', value, true);
419+
},
420+
409421
isValidSprSignature: function(value) {
410422
return _findBy('spr', value);
411423
},

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tibia-signatures",
3-
"version": "0.0.2",
3+
"version": "0.0.3",
44
"description": "Repository to store signatures of the Tibia files",
55
"main": "index.js",
66
"repository": {

0 commit comments

Comments
 (0)