/* Archeage Skill Calculator 2014/05/17 */ var points = 23; // Maximum for Archeage at lvl 50 var mTop = '-42px'; // Height of half the skill's image /* Code template: 21000110001001001x30011100000010010x81100010100100110 First number: Number of the skill tree 2 to 12: Active skills inside that tree 13 to end: Passive skills inside that tree */ /* ==================== LISTS RELATED ==================== */ /* Display the skills tree @el : HTML Element from the click (this) */ function tal_display(el) { var list = el.parentNode.parentNode.getElementsByTagName('div'); for (var i=0; i= el.dataset.req) { el.getElementsByTagName('img')[0].style.marginTop = mTop; points--; } else { alert('You can\'t skill this yet'); } } else { el.getElementsByTagName('img')[0].style.marginTop = mTop; points--; } } updatePoints(); } /* Restore the state of a skill tree when you change from the select @el : DIV element representing the skill tree */ function restore(el) { var tmp = el.getElementsByTagName('img'); for (var i=0; i highestRequirement) { highestRequirement = list[i].dataset.req; } } } if (highestRequirement > (nbElements(el) - 2) && highestRequirement != 0) { return false; } else { return true; } } /* ==================== URL / LINK RELATED ==================== */ /* Highlight the active skills from URL parameters @t : The parameter element for the trees (17 digits) @node : The HTML node that include the active skills elements */ function highlightActiveSkills(t, node) { for (var i=1; i<12; i++) { if (parseInt(t[i]) == 1) { var el = node.childNodes[i-1]; var img = el.getElementsByTagName('img'); img[0].style.marginTop = mTop; points--; } } updatePoints(); } /* Highlight the passive skills from URL parameters @t : The parameter element for the trees (17 digits) @node : The HTML node that include the passive skills elements */ function highlightPassiveSkills(t, node) { for (var i=12; i<17; i++) { if (parseInt(t[i]) == 1) { var el = node.childNodes[i-12]; var img = el.getElementsByTagName('img'); img[0].style.marginTop = mTop; points--; } } updatePoints(); } /* Returns the "number" of the skill's tree selected @el : HTML node of the SELECT */ function countSkillTree(el) { var select = el.childNodes[0]; var i=0; var bool = false; while (i' + url + ''; } /* Display particular build link if there is an URL parameter (talCode) */ window.onload = function () { if (document.URL.indexOf('talCode=') > 0) { var tab = document.URL.split('=')[1].split('x'); var dom = document.getElementById('tal_box'); for (var i=0; i