Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var max_points = 30
- var spent_points = 0
- var total_off = 0
- var total_def = 0
- var total_utl = 0
- $('document').ready(function() {
- $('table.masteries tr.p0 td:nth-child(1)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p0 td:nth-child(2)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p0 td:nth-child(3)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p0 td:nth-child(4)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p0 td:nth-child(5)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p0 td:nth-child(6)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p0 td:nth-child(7)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p0 td:nth-child(8)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p0 td:nth-child(9)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p0 td:nth-child(10)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p0 td:nth-child(11)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p0 td:nth-child(12)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p0 td').on('click', function(){
- if(spent_points < max_points) {
- if(!this.i){
- this.i = 0;
- }
- s = $(this).find('p').text()
- current_max = parseInt(s.substr(s.length - 1))
- if (
- $(this).is($(':nth-child(1)'))
- || $(this).is($(':nth-child(2)'))
- || $(this).is($(':nth-child(3)'))
- || $(this).is($(':nth-child(4)'))
- ) {
- if(this.i < current_max) {
- this.i = this.i+1
- total_off = total_off + 1
- spent_points = spent_points + 1
- $(this).find('span').text(this.i);
- $('span.offensive').text(total_off);
- $('span.spent').text(spent_points);
- }
- console.log(this.i);
- } else if (
- $(this).is($(':nth-child(5)'))
- || $(this).is($(':nth-child(6)'))
- || $(this).is($(':nth-child(7)'))
- || $(this).is($(':nth-child(8)'))
- ) {
- if(this.i < current_max) {
- this.i = this.i+1
- total_def = total_def + 1
- spent_points = spent_points + 1
- $(this).find('span').text(this.i);
- $('span.defensive').text(total_def);
- $('span.spent').text(spent_points);
- }
- console.log(this.i);
- } else if (
- $(this).is($(':nth-child(9)'))
- || $(this).is($(':nth-child(10)'))
- || $(this).is($(':nth-child(11)'))
- || $(this).is($(':nth-child(12)'))
- ) {
- if(this.i < current_max) {
- this.i = this.i+1
- total_utl = total_utl + 1
- spent_points = spent_points + 1
- $(this).find('span').text(this.i);
- $('span.utility').text(total_utl);
- $('span.spent').text(spent_points);
- }
- console.log(this.i);
- }
- if(total_off >= 4) {
- $('table.masteries tr.p4 td:nth-child(1)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p4 td:nth-child(2)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p4 td:nth-child(3)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p4 td:nth-child(4)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- }
- if(total_def >= 4) {
- $('table.masteries tr.p4 td:nth-child(5)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p4 td:nth-child(6)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p4 td:nth-child(8)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- }
- if(total_utl >= 4) {
- $('table.masteries tr.p4 td:nth-child(10)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p4 td:nth-child(11)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p4 td:nth-child(12)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- }
- }});
- $('table.masteries tr.p4 td').on('click', function(){
- if(spent_points < max_points) {
- if(!this.i){
- this.i = 0;
- }
- s = $(this).find('p').text()
- current_max = parseInt(s.substr(s.length - 1))
- if (
- $(this).is($(':nth-child(1)'))
- || $(this).is($(':nth-child(2)'))
- || $(this).is($(':nth-child(3)'))
- || $(this).is($(':nth-child(4)'))
- ) {
- if(this.i < current_max) {
- this.i = this.i+1
- total_off = total_off + 1
- spent_points = spent_points + 1
- $(this).find('span').text(this.i);
- $('span.offensive').text(total_off);
- $('span.spent').text(spent_points);
- }
- console.log(this.i);
- } else if (
- $(this).is($(':nth-child(5)'))
- || $(this).is($(':nth-child(6)'))
- || $(this).is($(':nth-child(7)'))
- || $(this).is($(':nth-child(8)'))
- ) {
- if(this.i < current_max) {
- this.i = this.i+1
- total_def = total_def + 1
- spent_points = spent_points + 1
- $(this).find('span').text(this.i);
- $('span.defensive').text(total_def);
- $('span.spent').text(spent_points);
- }
- console.log(this.i);
- } else if (
- $(this).is($(':nth-child(9)'))
- || $(this).is($(':nth-child(10)'))
- || $(this).is($(':nth-child(11)'))
- || $(this).is($(':nth-child(12)'))
- ) {
- if(this.i < current_max) {
- this.i = this.i+1
- total_utl = total_utl + 1
- spent_points = spent_points + 1
- $(this).find('span').text(this.i);
- $('span.utility').text(total_utl);
- $('span.spent').text(spent_points);
- }
- console.log(this.i);
- }
- if(total_off >= 8) {
- $('table.masteries tr.p8 td:nth-child(1)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p8 td:nth-child(2)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p8 td:nth-child(3)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p8 td:nth-child(4)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- }
- if(total_def >= 8) {
- $('table.masteries tr.p8 td:nth-child(5)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p8 td:nth-child(6)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p8 td:nth-child(7)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p8 td:nth-child(8)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- }
- if(total_utl >= 8) {
- $('table.masteries tr.p8 td:nth-child(9)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p8 td:nth-child(10)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p8 td:nth-child(11)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p8 td:nth-child(12)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- }
- }});
- $('table.masteries tr.p8 td').on('click', function(){
- if(spent_points < max_points) {
- if(!this.i){
- this.i = 0;
- }
- s = $(this).find('p').text()
- current_max = parseInt(s.substr(s.length - 1))
- if (
- $(this).is($(':nth-child(1)'))
- || $(this).is($(':nth-child(2)'))
- || $(this).is($(':nth-child(3)'))
- || $(this).is($(':nth-child(4)'))
- ) {
- if(this.i < current_max) {
- this.i = this.i+1
- total_off = total_off + 1
- spent_points = spent_points + 1
- $(this).find('span').text(this.i);
- $('span.offensive').text(total_off);
- $('span.spent').text(spent_points);
- }
- console.log(this.i);
- } else if (
- $(this).is($(':nth-child(5)'))
- || $(this).is($(':nth-child(6)'))
- || $(this).is($(':nth-child(7)'))
- || $(this).is($(':nth-child(8)'))
- ) {
- if(this.i < current_max) {
- this.i = this.i+1
- total_def = total_def + 1
- spent_points = spent_points + 1
- $(this).find('span').text(this.i);
- $('span.defensive').text(total_def);
- $('span.spent').text(spent_points);
- }
- console.log(this.i);
- } else if (
- $(this).is($(':nth-child(9)'))
- || $(this).is($(':nth-child(10)'))
- || $(this).is($(':nth-child(11)'))
- || $(this).is($(':nth-child(12)'))
- ) {
- if(this.i < current_max) {
- this.i = this.i+1
- total_utl = total_utl + 1
- spent_points = spent_points + 1
- $(this).find('span').text(this.i);
- $('span.utility').text(total_utl);
- $('span.spent').text(spent_points);
- }
- console.log(this.i);
- }
- if(total_off >= 12) {
- $('table.masteries tr.p12 td:nth-child(1)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p12 td:nth-child(2)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p12 td:nth-child(3)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p12 td:nth-child(4)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- }
- if(total_def >= 12) {
- $('table.masteries tr.p12 td:nth-child(5)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p12 td:nth-child(6)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p12 td:nth-child(7)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p12 td:nth-child(8)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- }
- if(total_utl >= 12) {
- $('table.masteries tr.p12 td:nth-child(9)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p12 td:nth-child(10)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p12 td:nth-child(11)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p12 td:nth-child(12)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- }
- }});
- $('table.masteries tr.p12 td').on('click', function(){
- if(spent_points < max_points) {
- if(!this.i){
- this.i = 0;
- }
- s = $(this).find('p').text()
- current_max = parseInt(s.substr(s.length - 1))
- if (
- $(this).is($(':nth-child(1)'))
- || $(this).is($(':nth-child(2)'))
- || $(this).is($(':nth-child(3)'))
- || $(this).is($(':nth-child(4)'))
- ) {
- if(this.i < current_max) {
- this.i = this.i+1
- total_off = total_off + 1
- spent_points = spent_points + 1
- $(this).find('span').text(this.i);
- $('span.offensive').text(total_off);
- $('span.spent').text(spent_points);
- }
- console.log(this.i);
- } else if (
- $(this).is($(':nth-child(5)'))
- || $(this).is($(':nth-child(6)'))
- || $(this).is($(':nth-child(7)'))
- || $(this).is($(':nth-child(8)'))
- ) {
- if(this.i < current_max) {
- this.i = this.i+1
- total_def = total_def + 1
- spent_points = spent_points + 1
- $(this).find('span').text(this.i);
- $('span.defensive').text(total_def);
- $('span.spent').text(spent_points);
- }
- console.log(this.i);
- } else if (
- $(this).is($(':nth-child(9)'))
- || $(this).is($(':nth-child(10)'))
- || $(this).is($(':nth-child(11)'))
- || $(this).is($(':nth-child(12)'))
- ) {
- if(this.i < current_max) {
- this.i = this.i+1
- total_utl = total_utl + 1
- spent_points = spent_points + 1
- $(this).find('span').text(this.i);
- $('span.utility').text(total_utl);
- $('span.spent').text(spent_points);
- }
- console.log(this.i);
- }
- if(total_off >= 16) {
- $('table.masteries tr.p16 td:nth-child(1)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p16 td:nth-child(2)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p16 td:nth-child(4)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- }
- if(total_def >= 16) {
- $('table.masteries tr.p16 td:nth-child(5)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p16 td:nth-child(6)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p16 td:nth-child(7)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- }
- if(total_utl >= 16) {
- $('table.masteries tr.p16 td:nth-child(10)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- $('table.masteries tr.p16 td:nth-child(11)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- }
- }});
- $('table.masteries tr.p16 td').on('click', function(){
- if(spent_points < max_points) {
- if(!this.i){
- this.i = 0;
- }
- s = $(this).find('p').text()
- current_max = parseInt(s.substr(s.length - 1))
- if (
- $(this).is($(':nth-child(1)'))
- || $(this).is($(':nth-child(2)'))
- || $(this).is($(':nth-child(4)'))
- ) {
- if(this.i < current_max) {
- this.i = this.i+1
- total_off = total_off + 1
- spent_points = spent_points + 1
- $(this).find('span').text(this.i);
- $('span.offensive').text(total_off);
- $('span.spent').text(spent_points);
- }
- console.log(this.i);
- } else if (
- $(this).is($(':nth-child(5)'))
- || $(this).is($(':nth-child(6)'))
- || $(this).is($(':nth-child(7)'))
- ) {
- if(this.i < current_max) {
- this.i = this.i+1
- total_def = total_def + 1
- spent_points = spent_points + 1
- $(this).find('span').text(this.i);
- $('span.defensive').text(total_def);
- $('span.spent').text(spent_points);
- }
- console.log(this.i);
- } else if (
- $(this).is($(':nth-child(10)'))
- || $(this).is($(':nth-child(11)'))
- ) {
- if(this.i < current_max) {
- this.i = this.i+1
- total_utl = total_utl + 1
- spent_points = spent_points + 1
- $(this).find('span').text(this.i);
- $('span.utility').text(total_utl);
- $('span.spent').text(spent_points);
- }
- console.log(this.i);
- }
- if(total_off >= 20) {
- $('table.masteries tr.p20 td:nth-child(2)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- }
- if(total_def >= 20) {
- $('table.masteries tr.p20 td:nth-child(6)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- }
- if(total_utl >= 20) {
- $('table.masteries tr.p20 td:nth-child(10)')
- .attr("style","background-image:url('./assets/masteries/mastery0.png')");
- }
- }});
- $('table.masteries tr.p20 td').on('click', function(){
- if(spent_points < max_points) {
- if(!this.i){
- this.i = 0;
- }
- s = $(this).find('p').text()
- current_max = parseInt(s.substr(s.length - 1))
- if ($(this).is($(':nth-child(2)'))) {
- if(this.i < current_max) {
- this.i = this.i+1
- total_off = total_off + 1
- spent_points = spent_points + 1
- $(this).find('span').text(this.i);
- $('span.offensive').text(total_off);
- $('span.spent').text(spent_points);
- }
- console.log(this.i);
- } else if ($(this).is($(':nth-child(6)'))) {
- if(this.i < current_max) {
- this.i = this.i+1
- total_def = total_def + 1
- spent_points = spent_points + 1
- $(this).find('span').text(this.i);
- $('span.defensive').text(total_def);
- $('span.spent').text(spent_points);
- }
- console.log(this.i);
- } else if ($(this).is($(':nth-child(10)'))) {
- if(this.i < current_max) {
- this.i = this.i+1
- total_utl = total_utl + 1
- spent_points = spent_points + 1
- $(this).find('span').text(this.i);
- $('span.utility').text(total_utl);
- $('span.spent').text(spent_points);
- }
- console.log(this.i);
- }
- }});
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement