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.
 
 
 

231 lines
4.7 KiB

  1. /*let items = [{
  2. name: 'Bronze Hilt',
  3. type: 'Material',
  4. quality: 0,
  5. stats: { '10% chance to roll [2 - 5] Strength': null },
  6. spritesheet: './IWD_Stuff.png',
  7. sprite: [10, 15]
  8. }, {
  9. name: 'Bronze Hilt',
  10. type: 'Material',
  11. quality: 1,
  12. stats: {
  13. '10% chance to roll [2 - 5] Strength': null,
  14. '10% chance to roll [1 - 4] Vitality': null
  15. },
  16. spritesheet: './IWD_Stuff.png',
  17. sprite: [10, 15]
  18. }, {
  19. name: 'Bronze Hilt',
  20. type: 'Material',
  21. quality: 1,
  22. stats: { '20% chance to roll [2 - 5] Dexterity': null },
  23. spritesheet: './IWD_Stuff.png',
  24. sprite: [10, 15]
  25. }, {
  26. name: 'Iron Blade',
  27. type: 'Material',
  28. quality: 0,
  29. stats: {
  30. '5% chance to roll [1% - 3%] Attack Speed': null,
  31. '5% chance to roll [2% - 4%] Attack Crit Chance': null
  32. },
  33. spritesheet: './IWD_Stuff.png',
  34. sprite: [11, 16]
  35. }, {
  36. name: 'Iron Blade',
  37. type: 'Material',
  38. quality: 1,
  39. stats: { '20% chance to roll [10% - 20%] Attack Crit Multiplier': null },
  40. spritesheet: './IWD_Stuff.png',
  41. sprite: [11, 16]
  42. }, {
  43. name: 'Iron Blade',
  44. type: 'Material',
  45. quality: 2,
  46. stats: { '30% chance to roll [1% - 3%] Attack Speed': null },
  47. spritesheet: './IWD_Stuff.png',
  48. sprite: [11, 16]
  49. }, {
  50. name: 'Infernal Bite',
  51. type: 'Curved Sword',
  52. rqr: {
  53. level: 25,
  54. dex: 200
  55. },
  56. quality: 4,
  57. stats: {
  58. Dexterity: '[200 - 300]',
  59. 'Increased Crit Multiplier': '[40% - 65%]',
  60. 'Your hits always critically hit': null,
  61. '50% of your damage is converted to fire damage': null,
  62. 'You take [2% - 5%] of all damage you deal yourself': null
  63. },
  64. spritesheet: '../../src/client/images/items.png',
  65. sprite: [9, 9]
  66. }, {
  67. name: 'Cowl of Obscurity',
  68. type: 'Silk Cowl',
  69. rqr: {
  70. level: 20,
  71. dex: 150
  72. },
  73. quality: 4,
  74. stats: {
  75. Vitality: '[20 - 35]',
  76. Dexterity: '[150 - 220]',
  77. 'Critical hits heal you for [1% - 3%] of your maximum health': null,
  78. 'Your hits have a 50% chance to miss': null
  79. },
  80. spritesheet: '../../src/client/images/items.png',
  81. sprite: [0, 4]
  82. }];*/
  83. //Mining
  84. const items2 = [
  85. { text: 'Reach Level 5' },
  86. { text: 'Train Mining' },
  87. { text: 'Buy Basic Mining Pick' },
  88. {
  89. name: 'Iron Mining Pick',
  90. type: 'Tool',
  91. quality: 0,
  92. spritesheet: './IWD_Stuff.png',
  93. sprite: [4, 12]
  94. },
  95. { text: 'Mine Iron Ore' },
  96. {
  97. name: 'Iron Ore',
  98. type: 'Material',
  99. quality: 0,
  100. spritesheet: './IWD_Stuff.png',
  101. sprite: [4, 11]
  102. },
  103. { text: 'Gain Mining Skill' },
  104. { text: 'Craft Iron Bars' },
  105. {
  106. name: 'Iron Bar',
  107. type: 'Material',
  108. quality: 0,
  109. spritesheet: './IWD_Stuff.png',
  110. sprite: [0, 11]
  111. },
  112. { text: 'Gain Mining Skill' }
  113. ];
  114. //Blacksmithing
  115. const items = [
  116. { text: 'Reach Level 5' },
  117. { text: 'Train Blacksmithing' },
  118. { text: 'Buy Hammer' },
  119. {
  120. name: 'Iron Blacksmith\'s Hammer',
  121. type: 'Tool',
  122. quality: 0,
  123. spritesheet: './IWD_Stuff.png',
  124. sprite: [0, 12]
  125. },
  126. { text: 'Train Glove Plate Recipe' },
  127. {
  128. name: 'Iron Glove Plate',
  129. type: 'Recipe',
  130. quality: 0,
  131. spritesheet: '../../src/client/images/consumables.png',
  132. sprite: [0, 5]
  133. },
  134. { text: 'Obtain Iron Bars' },
  135. { text: 'Craft Plates' },
  136. {
  137. name: 'Iron Glove Plate',
  138. type: 'Material',
  139. quality: 0,
  140. spritesheet: './IWD_Stuff.png',
  141. sprite: [13, 14]
  142. },
  143. { text: 'Gain Skill' },
  144. { text: 'Train Iron Gloves Recipe' },
  145. { text: 'Craft Iron Bars' },
  146. {
  147. name: 'Iron Gloves',
  148. type: 'Recipe',
  149. quality: 0,
  150. spritesheet: '../../src/client/images/consumables.png',
  151. sprite: [0, 5]
  152. },
  153. { text: 'Craft Gloves' },
  154. {
  155. name: 'Iron Gloves',
  156. type: 'Recipe',
  157. quality: 0,
  158. spritesheet: '../../src/client/images/items.png',
  159. sprite: [3, 0]
  160. },
  161. { text: 'Gain Skill' }
  162. ];
  163. const htmlItem = `
  164. <div class="tooltip">
  165. <div class="sprite-box">
  166. <div class="sprite"></div>
  167. </div>
  168. <div class="name"></div>
  169. <div class="type"></div>
  170. <div class="rqr"></div>
  171. <div class="stats"></div>
  172. <div class="description"></div>
  173. </div>`;
  174. const buildItem = item => {
  175. const div = $(htmlItem).appendTo('body');
  176. for (let p in item)
  177. div.find('.' + p).html(item[p]);
  178. let stats = item.stats;
  179. if (stats) {
  180. let val = '';
  181. for (let s in stats) {
  182. let v = s;
  183. if (stats[s])
  184. v = stats[s] + ' ' + s;
  185. val += '<div class="stat">' + v + '</div>';
  186. }
  187. div.find('.stats').html(val);
  188. }
  189. let rqr = item.rqr;
  190. if (rqr) {
  191. let val = 'Requires: ';
  192. for (let s in rqr) {
  193. val += rqr[s] + ' ' + s;
  194. if (Object.keys(rqr).indexOf(s) < Object.keys(rqr).length - 1)
  195. val += ', ';
  196. }
  197. div.find('.rqr').html(val);
  198. }
  199. const bg = `url('${item.spritesheet}') ${(-item.sprite[0] * 64)}px ${(-item.sprite[1] * 64)}px`;
  200. div.find('.sprite')
  201. .css({ background: bg })
  202. .html('');
  203. div.find('.name').addClass('q' + item.quality);
  204. };
  205. const htmlText = '<div class=\'text\'></div>';
  206. const buildText = ({ text }) => {
  207. const div = $(htmlText)
  208. .appendTo('body')
  209. .html(text);
  210. };
  211. $(function () {
  212. items.forEach(item => {
  213. if (item.text)
  214. buildText(item);
  215. else
  216. buildItem(item);
  217. });
  218. });