You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

82 lines
1.8 KiB

  1. $(function () {
  2. var items = [{
  3. name: `Infernal Bite`,
  4. type: 'Curved Sword',
  5. rqr: {
  6. level: 25,
  7. dex: 200
  8. },
  9. quality: 4,
  10. stats: {
  11. Dexterity: '[200 - 300]',
  12. 'Increased Crit Multiplier': '[40% - 65%]',
  13. 'Your hits always critically hit': null,
  14. '50% of your damage is converted to fire damage': null,
  15. 'You take [2% - 5%] of all damage you deal yourself': null
  16. },
  17. spritesheet: '../../src/client/images/items.png',
  18. sprite: [9, 9]
  19. }, {
  20. name: `Cowl of Obscurity`,
  21. type: 'Silk Cowl',
  22. rqr: {
  23. level: 20,
  24. dex: 150
  25. },
  26. quality: 4,
  27. stats: {
  28. Vitality: '[20 - 35]',
  29. Dexterity: '[150 - 220]',
  30. 'Critical hits heal you for [1% - 3%] of your maximum health': null,
  31. 'Your hits have a 50% chance to miss': null,
  32. },
  33. spritesheet: '../../src/client/images/items.png',
  34. sprite: [0, 4]
  35. }];
  36. for (var i = 0; i < items.length - 1; i++) {
  37. $('.tooltip:first-child').clone().appendTo('body');
  38. }
  39. items.forEach(function (item, i) {
  40. var div = $('.tooltip').eq(i);
  41. for (var p in item) {
  42. var val = item[p];
  43. div.find('.' + p).html(val);
  44. }
  45. var stats = item.stats;
  46. if (stats) {
  47. var val = '';
  48. for (var s in stats) {
  49. var v = s;
  50. if (stats[s])
  51. v = stats[s] + ' ' + s;
  52. val += '<div class="stat">' + v + '</div>';
  53. }
  54. div.find('.stats').html(val);
  55. }
  56. var rqr = item.rqr;
  57. if (rqr) {
  58. var val = 'Requires: ';
  59. for (var s in rqr) {
  60. val += rqr[s] + ' ' + s;
  61. if (Object.keys(rqr).indexOf(s) < Object.keys(rqr).length - 1)
  62. val += ', ';
  63. }
  64. div.find('.rqr').html(val);
  65. }
  66. div.find('.sprite')
  67. .css({
  68. background: 'url(' + item.spritesheet + ') ' + (-item.sprite[0] * 64) + 'px ' + (-item.sprite[1] * 64) + 'px'
  69. })
  70. .html('');
  71. div.find('.name').addClass('q' + item.quality);
  72. });
  73. });