Skip to content

Commit

Permalink
Version 0.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
gpedro committed Dec 16, 2014
1 parent 9e75ecd commit 988772e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,21 @@ Repository to store signatures of the Tibia files
`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`

## API

* getSignatureByVersion(version)
* version - required - Client Version without dots
* returns Array or Object
* getVersionBySprSignature(hexSign)
* hexSign - required - First 4 bytes from Spr file
* returns Integer
* getVersionByDatSignature(hexSign)
* hexSign - required - First 4 bytes reversed from Dat file
* returns Integer
* isValidSprSignature(hexSign)
* hexSign - required - First 4 bytes from Spr file
* hexSign - required - First 4 bytes from Spr file
* return Boolean
* isValidDatSignature(hexSign)
* hexSign - required - First 4 bytes reversed from Dat file
* return Boolean

## References

Expand Down
18 changes: 15 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,19 +384,19 @@ clients = {
}
};

_findBy = function(type, value) {
_findBy = function(type, value, returnVersion) {
value = value.toUpperCase();
for(var version in clients) {
var client = clients[version];
if(Array.isArray(client)) {
for(var rev in client) {
if(client[rev][type] == value) {
return true;
return (returnVersion) ? version : true;
}
}
} else {
if(client[type] == value) {
return true;
return (returnVersion) ? version : true;
}
}
}
Expand All @@ -406,6 +406,18 @@ _findBy = function(type, value) {

module.exports = {

getSignatureByVersion: function(version) {
return (version in clients) ? clients[version] : false;
},

getVersionBySprSignature: function(value) {
return _findBy('spr', value, true);
},

getVersionByDatSignature: function(value) {
return _findBy('dat', value, true);
},

isValidSprSignature: function(value) {
return _findBy('spr', value);
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tibia-signatures",
"version": "0.0.2",
"version": "0.0.3",
"description": "Repository to store signatures of the Tibia files",
"main": "index.js",
"repository": {
Expand Down

0 comments on commit 988772e

Please sign in to comment.