Forgot password?
 Join Now!

Quiz Cheat Sheet Questions & Answers

Eidolon Prayer System Overview of Eidolon's Wishes

Fish King Timer Getting Ready To Go!

Archeology Guide Start Digging Now!

View: 4268|Reply: 9

[Data] [Tool] Aura Kingdom Envoy's Path Simulator

[Copy link]

55

Threads

95

Posts

2106

Credits

Administrator

Rank: 9Rank: 9Rank: 9

Credits
2106

Official Guildless Member

5-14-2014 12:15:52 | Show all posts |Reader
Aura Kingdom Envoy's Path Simulator


Aura Kingdom Envoy's Path Simulator Preview:
http://guildless.net/envoy/

Special Credits:
Credits to Arrandale's Awsome Envoy's Path API!

Note:
This used to be part of the AKCS, due to laziness to work on the character simulator.
I decided to take this envoy path out as stand alone tool for the public, hope you guys will like it.

Changelog:  (Shift + F5 to cache news files)
8/16/2016: Intergrated goo.gl url shortener for more user friendly.
7/27/2016: Updated Ninja's envoy's path text decription, Shift+F5 on the envoy page to update your browser cache.
6/22/2016: Added Ninja's envoy's path, (gathered info from ps AK, will fix the errors when ninja arrive to our version)
6/6/2016: Release Envoy's Path Simulator to the public
6/5/2016: Added Get URL function, using this for sharing envoy's path with others
4/13/2016: Improving the codes
3/26/2016: Fix javascript errors, added user manual
8/25/2015: Added Envoy's Path, Thanks to Arrandale great works on the path API

Phrase Two, gathering information

Intergrate goo.gl url shortener
  1. //Google url shorten
  2. function makeRequest(input) {
  3.         console.log(input);
  4.     var url = input;
  5.     var request = gapi.client.urlshortener.url.insert({
  6.         'resource': {
  7.             'longUrl': url
  8.         }
  9.     });
  10.     request.execute(function(response) {
  11.             console.log(response);
  12.         if (response.id != null) {
  13.             document.getElementById('linkbox2').value = response.id;
  14.         } else {
  15.             document.getElementById('linkbox2').value = "Error: Creating Short URL - " + response.error;
  16.         }
  17.     });
  18. }
Copy the Code

Code for coverting binary to hexdecimal, and hexdecial to binary
Coverting codes by lightningkid (View His Post)
  1. var Converter = (function(){
  2.   function binaryToHex(number) {
  3.     return parseInt(number, 2).toString(16);
  4.   }
  5.   
  6.   function hexToBinary(hex) {
  7.     var binary = parseInt(hex, 16).toString(2);
  8.     return addPadding(binary.length, binary); //add padding;  
  9.   }
  10.    
  11.   function addPadding(length, binary){
  12.     if(!length) return binary;
  13.     return "0000".substr(length) + binary; //add padding;
  14.   }
  15.   
  16.   function convert(numberStr, regex, converterFn){
  17.     var splitted = numberStr.match(regex)
  18.     return splitted.reduce(function(curr, str){
  19.       return curr + converterFn(str);
  20.     }, "")
  21.   }
  22.   
  23.   function convertBinaryToHex(binaryString){
  24.     var padding = binaryString.length % 4;
  25.     binaryString = addPadding(padding, binaryString);  

  26.     return convert(binaryString, /[01]{4}/gi, binaryToHex);
  27.   }
  28.   
  29.   function convertHexToBinary(hexString){
  30.     return convert(hexString, /[0-9a-f]/gi, hexToBinary);
  31.   }
  32.   
  33.   return {
  34.     BinaryToHex: convertBinaryToHex,
  35.     HexToBinary:  convertHexToBinary
  36.   }
  37. })();
Copy the Code
Oringal coverting code:
  1. //Covert binary to hexdecimal
  2. function binaryToHex(s) {
  3.     var i, k, part, accum, ret = '';
  4.     for (i = s.length-1; i >= 3; i -= 4) {
  5.         // extract out in substrings of 4 and convert to hex
  6.         part = s.substr(i+1-4, 4);
  7.         accum = 0;
  8.         for (k = 0; k < 4; k += 1) {
  9.             if (part[k] !== '0' && part[k] !== '1') {
  10.                 // invalid character
  11.                 return { valid: false };
  12.             }
  13.             // compute the length 4 substring
  14.             accum = accum * 2 + parseInt(part[k], 10);
  15.         }
  16.         if (accum >= 10) {
  17.             // 'A' to 'F'
  18.             ret = String.fromCharCode(accum - 10 + 'A'.charCodeAt(0)) + ret;
  19.         } else {
  20.             // '0' to '9'
  21.             ret = String(accum) + ret;
  22.         }
  23.     }
  24.     // remaining characters, i = 0, 1, or 2
  25.     if (i >= 0) {
  26.         accum = 0;
  27.         // convert from front
  28.         for (k = 0; k <= i; k += 1) {
  29.             if (s[k] !== '0' && s[k] !== '1') {
  30.                 return { valid: false };
  31.             }
  32.             accum = accum * 2 + parseInt(s[k], 10);
  33.         }
  34.         // 3 bits, value cannot exceed 2^3 - 1 = 7, just convert
  35.         ret = String(accum) + ret;
  36.     }
  37.     return { valid: true, result: ret };
  38. }
  39. //Covert hexdecimal to binary
  40. function hexToBinary(s) {
  41.     var i, k, part, ret = '';
  42.     // lookup table for easier conversion. '0' characters are padded for '1' to '7'
  43.     var lookupTable = {
  44.         '0': '0000', '1': '0001', '2': '0010', '3': '0011', '4': '0100',
  45.         '5': '0101', '6': '0110', '7': '0111', '8': '1000', '9': '1001',
  46.         'a': '1010', 'b': '1011', 'c': '1100', 'd': '1101',
  47.         'e': '1110', 'f': '1111',
  48.         'A': '1010', 'B': '1011', 'C': '1100', 'D': '1101',
  49.         'E': '1110', 'F': '1111'
  50.     };
  51.     for (i = 0; i < s.length; i += 1) {
  52.         if (lookupTable.hasOwnProperty(s[i])) {
  53.             ret += lookupTable[s[i]];
  54.         } else {
  55.             return { valid: false };
  56.         }
  57.     }
  58.     return { valid: true, result: ret };
  59. }
Copy the Code



Code Sample for Envoy's Path Stats
  1. var commonCells = {

  2.     'battleTactics1': {
  3.         name: 'Battle Tactics 1',
  4.         description: 'Use your familiarity with fighting monsters to your advantage.',
  5.         effectText: ['DMG +1%'],
  6.         effectIcon: [envoyPathImgPath + 'up.png'],
  7.         DMG: 1,
  8.         img: envoyPathImgPath + 'common/dmg.png'
  9.     },

  10.     'battleTactics2': {
  11.         name: 'Battle Tactics 2',
  12.         description: 'Take the experience you\'ve learned in battle to gauge the best way to strike foes.',
  13.         effectText: ['DMG +2%'],
  14.         effectIcon: [envoyPathImgPath + 'up.png'],
  15.         DMG: 2,
  16.         img: envoyPathImgPath + 'common/dmg.png'
  17.     },

  18.     'battleTactics3': {
  19.         name: 'Battle Tactics 3',
  20.         description: 'A seasoned career in monster fighting has given you knowledge of how to hit where it hurts most.',
  21.         effectText: ['DMG +4%'],
  22.         effectIcon: [envoyPathImgPath + 'up.png'],
  23.         DMG: 4,
  24.         img: envoyPathImgPath + 'common/dmg.png'
  25.     },

  26.     'weakPointAnalysis1': {
  27.         name: 'Weak Point Analysis 1',
  28.         description: 'Gain familiarity with monsters slightly increasing your chance of a critical strike.',
  29.         effectText: ['CRIT +0.8%'],
  30.         effectIcon: [envoyPathImgPath + 'up.png'],
  31.         CRIT: 0.8,
  32.         img: envoyPathImgPath + 'common/crit.png'
  33.     },
Copy the Code


I have few choices on the data storaging options: xml, json, or localStorage
JSON
Pro:
  • Simple syntax, which results in less "markup" overhead compared to XML.
  • Easy to use with JavaScript as the markup is a subset of JS object literal notation and has the same basic data types as JavaScript.

Con:
  • Simple syntax, only a handful of different data types are supported.

XML
Pro:
  • Generalized markup; it is possible to create "dialects" for any kind of purpose
  • XML Schema for datatype, structure validation. Makes it also possible to create new datatypes
  • XSLT for transformation into different output formats
  • XPath/XQuery for extracting information (which makes getting information in deeply nested structures much easier then with JSON)
  • Built in support for namespaces

Con:
  • Relatively wordy compared to JSON (results in more data for the same amount of information).

localStorage
Pro:
  • Very easy to use and memorize the api.
  • Synchronous API - no need for writing a callback just to get your data
  • Supported on more browsers

Con:
  • Objects must be serialized (would be nice if they did this for you!), potential performance impact of JSON serialization / deserialization.
  • Not nearly as powerful as SQL, which can sort, search and aggregate data much easier.

Formatting on the file
Let me know if I missed something..

Class Reference:
  1. a = Duelist
  2. b = Guardian
  3. c = Ravager
  4. d = Wizard
  5. e = Gunslinger
  6. f = Grenadier
  7. g = Sorcerer
  8. h = Bard
  9. i = Brawler
  10. j = Warbow
  11. k = Ronin
  12. l = Necromancer
  13. m= Holy Sword
Copy the Code
Phrase One, HTML + CSS markup

This post contains more resources

You have to Login for download or view attachment(s). No Account? Register

x
Reply

Use magic Report

55

Threads

95

Posts

2106

Credits

Administrator

Rank: 9Rank: 9Rank: 9

Credits
2106

Official Guildless Member

 Author| 6-6-2016 20:37:22 | Show all posts
Code for coverting binary to hexdecimal, and hexdecial to binary
  1. //Covert binary to hexdecimal
  2. function binaryToHex(s) {
  3.     var i, k, part, accum, ret = '';
  4.     for (i = s.length-1; i >= 3; i -= 4) {
  5.         // extract out in substrings of 4 and convert to hex
  6.         part = s.substr(i+1-4, 4);
  7.         accum = 0;
  8.         for (k = 0; k < 4; k += 1) {
  9.             if (part[k] !== '0' && part[k] !== '1') {
  10.                 // invalid character
  11.                 return { valid: false };
  12.             }
  13.             // compute the length 4 substring
  14.             accum = accum * 2 + parseInt(part[k], 10);
  15.         }
  16.         if (accum >= 10) {
  17.             // 'A' to 'F'
  18.             ret = String.fromCharCode(accum - 10 + 'A'.charCodeAt(0)) + ret;
  19.         } else {
  20.             // '0' to '9'
  21.             ret = String(accum) + ret;
  22.         }
  23.     }
  24.     // remaining characters, i = 0, 1, or 2
  25.     if (i >= 0) {
  26.         accum = 0;
  27.         // convert from front
  28.         for (k = 0; k <= i; k += 1) {
  29.             if (s[k] !== '0' && s[k] !== '1') {
  30.                 return { valid: false };
  31.             }
  32.             accum = accum * 2 + parseInt(s[k], 10);
  33.         }
  34.         // 3 bits, value cannot exceed 2^3 - 1 = 7, just convert
  35.         ret = String(accum) + ret;
  36.     }
  37.     return { valid: true, result: ret };
  38. }
  39. //Covert hexdecimal to binary
  40. function hexToBinary(s) {
  41.     var i, k, part, ret = '';
  42.     // lookup table for easier conversion. '0' characters are padded for '1' to '7'
  43.     var lookupTable = {
  44.         '0': '0000', '1': '0001', '2': '0010', '3': '0011', '4': '0100',
  45.         '5': '0101', '6': '0110', '7': '0111', '8': '1000', '9': '1001',
  46.         'a': '1010', 'b': '1011', 'c': '1100', 'd': '1101',
  47.         'e': '1110', 'f': '1111',
  48.         'A': '1010', 'B': '1011', 'C': '1100', 'D': '1101',
  49.         'E': '1110', 'F': '1111'
  50.     };
  51.     for (i = 0; i < s.length; i += 1) {
  52.         if (lookupTable.hasOwnProperty(s[i])) {
  53.             ret += lookupTable[s[i]];
  54.         } else {
  55.             return { valid: false };
  56.         }
  57.     }
  58.     return { valid: true, result: ret };
  59. }
Copy the Code
Reply Support Not support

Use magic Report

0

Threads

6

Posts

75

Credits

Member

Rank: 2

Credits
75
8-15-2016 17:50:34 | Show all posts
Hi, there's an easier way of converting numbers in javascript:

convert Binary to hex example:
  1. parseInt("1111", 2).toString(16)
Copy the Code

convert hex to binary:
  1. parseInt("FF", 16).toString(2)
Copy the Code

sample: https://jsfiddle.net/s10usg20/1/
Reply Support Not support

Use magic Report

55

Threads

95

Posts

2106

Credits

Administrator

Rank: 9Rank: 9Rank: 9

Credits
2106

Official Guildless Member

 Author| 8-15-2016 22:14:13 | Show all posts
lightningkid replied at 8-15-2016 17:50
Hi, there's an easier way of converting numbers in javascript:

convert Binary to hex example:
Thanks for the code by the way. But there a problem with your codes.
Your JavaScript is removing the initial padding zeros, which I needed to determine certain tile is ticked or not.

Like when I put "13004E00", it will turns out "1001 1000 0000 0010 0111 0000 0000 0",
But I am expecting "0001 0011 0000 0000 0100 1110 0000 0000".
Reply Support Not support

Use magic Report

0

Threads

6

Posts

75

Credits

Member

Rank: 2

Credits
75
8-16-2016 02:02:49 | Show all posts
Edited by lightningkid at 8-16-2016 02:17

Hi, thank you for pointing out problem. I didn't notice the need to pad them.
I updated the jsfiddle to add the padding zeros.

Here's the sample:link
Reply Support Not support

Use magic Report

55

Threads

95

Posts

2106

Credits

Administrator

Rank: 9Rank: 9Rank: 9

Credits
2106

Official Guildless Member

 Author| 8-16-2016 07:41:40 | Show all posts
lightningkid replied at 8-16-2016 02:02
Hi, thank you for pointing out problem. I didn't notice the need to pad them.
I updated the jsfiddl ...

Okay, I will put a scenario for you to test your code out.

As you can see Envoy's Path contains 81 tiles (9x9)
Each tile going to be either 0 or 1, where 0 = unchecked, 1 = checked

So for full blank Envoy's Path will contains 81 zeros. since binary numbers are in set of 4, will rounds it up to 84 zeros as below
  1. 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
Copy the Code

Since no one likes to type long and confusing URL, shorten it by converting it into hex.
So, that's where the problem comes, will your code able to handling 84 digits of binary numbers?

P.S I might intergrate goo.gl shortener in the future, which will further reduce URL length.
Reply Support Not support

Use magic Report

0

Threads

6

Posts

75

Credits

Member

Rank: 2

Credits
75
8-16-2016 22:08:17 | Show all posts
Edited by lightningkid at 8-16-2016 22:12

Hi, Thank you for explaining the problem. I was suggesting about using parseInt and toString methods but I had not taken into account the constraints we are dealing with, my apologies.
My code before cannot correctly calculate 81 bits of binary as it is too big for native library to convert decimal into hex. So i modified the code a little bit, here's some info about it:
- should handle any number of digits in binary (tested up to 1024 digits)
- should add padding when converting hex to binary
- should be able to convert only correct binary and hex strings, validation should be done outside the code i think.

Here's the sample code :  http://plnkr.co/edit/eoU4p5mau3gmVH08ibtM?p=preview
Please take a look at convert.js
It has 2 public functions: Converter.BinaryToHex, Converter.HexToBinary

Algorithm for converting binary to hex:
  • Add 0's padding to the binary string and make its length a multiple of 4.
  • Split the binary string into groups of 4.
  • Convert each group into a hex digit.
  • Concatenate all the hex digits



Algorithm for converting hex to binary:
  • Split the string in to 1 digit hex
  • Convert hex into binary
  • Add leading 0's to the binary string
  • Concatenate all the binary digits

Btw, just disregard the external libraries jQuery and knockout, i only use them for display purposes.
Cheers! :3

Reply Support Not support

Use magic Report

55

Threads

95

Posts

2106

Credits

Administrator

Rank: 9Rank: 9Rank: 9

Credits
2106

Official Guildless Member

 Author| 8-16-2016 22:35:13 | Show all posts
lightningkid replied at 8-16-2016 22:08
Hi, Thank you for explaining the problem. I was suggesting about using parseInt and toString methods ...

Good works by the way!

After saw your first post,
I intergrated  goo.gl url shortener, it is now more user friendly.
Reply Support Not support

Use magic Report

0

Threads

6

Posts

75

Credits

Member

Rank: 2

Credits
75
8-16-2016 23:35:08 | Show all posts
You welcome.. :3
Reply Support Not support

Use magic Report

0

Threads

1

Posts

4

Credits

Newbie

Rank: 1

Credits
4
2-9-2017 15:08:46 | Show all posts
will the simulator be updated to the ones in the game? some nodes are still in the pre-nerfed
Reply Support Not support

Use magic Report

You have to log in before you can reply Login | Join Now!

Points Rules

6-22-2017 22:30 GMT-5 , Processed in 0.128400 second(s), 32 queries .

© 2001-2016 Powered by Discuz!

Quick Reply To Top Return to the list