Advertisement
Guest User

Untitled

a guest
Aug 25th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.89 KB | None | 0 0
  1. function LootFilter() {
  2. function setLoots(j, h) {
  3. var f = {
  4. want: [],
  5. not: [],
  6. must: []
  7. };
  8. var k = g.loots.want;
  9. var c = g.loots.not;
  10. var d = g.loots.must;
  11. for (var e = 0; e < k.length; e++) {
  12. var b = k[e];
  13. if ($("#loot" + b).hasClass("yours")) {
  14. continue
  15. }
  16. if (j != false && b == j) {
  17. f[h].push(j)
  18. } else {
  19. f.want.push(b)
  20. }
  21. }
  22. for (var e = 0; e < c.length; e++) {
  23. var b = c[e];
  24. if ($("#loot" + b).hasClass("yours")) {
  25. continue
  26. }
  27. if (j != false && b == j) {
  28. f[h].push(j)
  29. } else {
  30. f.not.push(b)
  31. }
  32. }
  33. for (var e = 0; e < d.length; e++) {
  34. var b = d[e];
  35. if ($("#loot" + b).hasClass("yours")) {
  36. continue
  37. }
  38. if (j != false && b == j) {
  39. f[h].push(j)
  40. } else {
  41. f.must.push(b)
  42. }
  43. }
  44. g.loots.want = f.want;
  45. g.loots.not = f.not;
  46. g.loots.must = f.must;
  47. }
  48.  
  49. function createLine() {
  50. let newLine = $('<div class="line">').css({
  51. display: 'flex',
  52. lineHeight: '19px',
  53. maxHeight: '19px'
  54. });
  55. for (var i = 0; i < arguments.length; i++) {
  56. newLine.append(arguments[i]);
  57. }
  58. return newLine;
  59. }
  60.  
  61. var __this = this;
  62. var mainBox = $('<div id="ulootfilter"></div>').css({
  63. width: 150,
  64. zIndex: 500,
  65. background: '#000',
  66. border: '2px solid #202020',
  67. color: '#e3e3e3',
  68. fontFamily: 'Arial, sans-serif',
  69. fontSize: '11px',
  70. textAlign: 'left',
  71. position: 'absolute',
  72. padding: '3px',
  73. cursor: 'grab',
  74. height: 38,
  75. overflow: 'hidden',
  76. borderRadius: '4px',
  77. boxShadow: '0 0 8px rgba(0, 0, 0, 0.8)'
  78. }).draggable({
  79. opacity: 0.7,
  80. start: function() {
  81. g.lock.add('dragging');
  82. Tip.disable();
  83. $(this).css({
  84. cursor: 'grabbing'
  85. });
  86. },
  87. stop: function() {
  88. __this.saveSettings();
  89. g.lock.remove('dragging');
  90. Tip.enable();
  91. $(this).css({
  92. cursor: 'grab'
  93. });
  94. }
  95. });
  96. $('<div></div>').attr({
  97. tip: 'Pokakaż więcej opcji'
  98. }).css({
  99. backgroundImage: 'url(http://i.imgur.com/JnqHa4K.png)',
  100. backgroundSize: 15,
  101. height: '15px',
  102. width: '15px',
  103. position: 'absolute',
  104. top: '3px',
  105. right: '3px'
  106. }).toggle(function() {
  107. mainBox.stop().animate({
  108. height: 295
  109. }, 500)
  110. }, function() {
  111. mainBox.stop().animate({
  112. height: 38
  113. }, 500)
  114. }).appendTo(mainBox);
  115. var filterInput = $('<input>').css({
  116. backgroundColor: '#000',
  117. border: '1px solid #202020',
  118. padding: '1px',
  119. width: 50,
  120. color: '#e3e3e3',
  121. margin: 'auto 3px',
  122. borderRadius: '3px',
  123. fontSize: '11px'
  124. }).change(function() {
  125. __this.saveSettings()
  126. });
  127. var autoQuitCheckbox = $('<input>').attr('type', 'checkbox').attr('id', 'LFME_autoQuitCheckbox').change(function() {
  128. __this.saveSettings()
  129. });
  130. var legendaryCheckbox = $('<input>').attr('type', 'checkbox').attr('id', 'LFME_legendaryCheckbox').change(function() {
  131. __this.saveSettings()
  132. });
  133. var heroicCheckbox = $('<input>').attr('type', 'checkbox').attr('id', 'LFME_heroicCheckbox').change(function() {
  134. __this.saveSettings()
  135. });
  136. var uniqueCheckbox = $('<input>').attr('type', 'checkbox').attr('id', 'LFME_uniqueCheckbox').change(function() {
  137. __this.saveSettings()
  138. });
  139. var mixCheckbox = $('<input>').attr('type', 'checkbox').attr('id', 'LFME_mixCheckbox').change(function() {
  140. __this.saveSettings()
  141. });
  142. var goldCheckbox = $('<input>').attr('type', 'checkbox').attr('id', 'LFME_goldCheckbox').change(function() {
  143. __this.saveSettings()
  144. });
  145. var arrowCheckbox = $('<input>').attr('type', 'checkbox').attr('id', 'LFME_arrowCheckbox').change(function() {
  146. __this.saveSettings()
  147. });
  148. var valueCheckbox = $('<input>').attr('type', 'checkbox').attr('id', 'LFME_valueCheckbox').change(function() {
  149. __this.saveSettings()
  150. });
  151. var tpCheckbox = $('<input>').attr('type', 'checkbox').attr('id', 'LFME_tpCheckbox').change(function() {
  152. __this.saveSettings()
  153. });
  154. var runesCheckbox = $('<input>').attr('type', 'checkbox').attr('id', 'LFME_runesCheckbox').change(function() {
  155. __this.saveSettings()
  156. });
  157. var blessCheckbox = $('<input>').attr('type', 'checkbox').attr('id', 'LFME_blessCheckbox').change(function() {
  158. __this.saveSettings()
  159. });
  160. var tytonCheckbox = $('<input>').attr('type', 'checkbox').attr('id', 'LFME_tytonCheckbox').change(function () {
  161. __this.saveSettings()
  162. });
  163. var serceCheckbox = $('<input>').attr('type', 'checkbox').attr('id', 'LFME_serceCheckbox').change(function () {
  164. __this.saveSettings()
  165. });
  166. var glowaCheckbox = $('<input>').attr('type', 'checkbox').attr('id', 'LFME_glowaCheckbox').change(function () {
  167. __this.saveSettings()
  168. });
  169. mainBox.append(createLine('<span style="font-weight: 700; padding-left: 3px">Loot Filter'));
  170. mainBox.append(createLine(valueCheckbox, '<label for="LFME_valueCheckbox" tip="Łapanie przedmiotów od określonej wartości">Powyżej: </label>', filterInput));
  171. mainBox.append($('<separator style="display: flex; height: 3px; border-bottom: 1px dotted #202020; margin-bottom: 3px">'));
  172. mainBox.append(createLine(legendaryCheckbox, '<label for="LFME_legendaryCheckbox" tip="Łapanie legend" style="color: #fa9a20">Legendarne</label>'));
  173. mainBox.append(createLine(heroicCheckbox, '<label for="LFME_heroicCheckbox" tip="Łapanie heroików" style="color: #2090fe">Heroiczne</label>'));
  174. mainBox.append(createLine(uniqueCheckbox, '<label for="LFME_uniqueCheckbox" tip="Łapanie unikatów" style="color: #daa520">Unikatowe</label>'));
  175. mainBox.append(createLine(mixCheckbox, '<label for="LFME_mixCheckbox" tip="Łapanie miksturek" style="color: #f0032a">Mikstury</label>'));
  176. mainBox.append(createLine(arrowCheckbox, '<label for="LFME_arrowCheckbox" tip="Łapanie strzałek" style="color: brown">Strzały</label>'));
  177. mainBox.append(createLine(tpCheckbox, '<label for="LFME_tpCheckbox" tip="Łapanie teleportów" style="color: green">Teleporty</label>'));
  178. mainBox.append(createLine(goldCheckbox, '<label for="LFME_goldCheckbox" tip="Łapanie złota" style="color: gold">Złoto</label>'));
  179. mainBox.append(createLine(runesCheckbox, '<label for="LFME_runesCheckbox" tip="Łapanie run" style="color: maroon">Runy</label>'));
  180. mainBox.append(createLine(blessCheckbox, '<label for="LFME_blessCheckbox" tip="Łapanie błogosławieństw" style="color: purple">Błogosławieństwa</label>'));
  181. mainBox.append(createLine(tytonCheckbox, '<label for="LFME_tytonCheckbox" tip="Łapanie Tytoniu" style="color: lime">Tytoń</label>'));
  182. mainBox.append(createLine(serceCheckbox, '<label for="LFME_tytonCheckbox" tip="Łapanie Serc" style="color: pink">Serca</label>'));
  183. mainBox.append(createLine(glowaCheckbox, '<label for="LFME_glowaCheckbox" tip="Łapanie Głów" style="color: lime">Głowy</label>'));
  184. mainBox.append(createLine(autoQuitCheckbox, '<label for="LFME_autoQuitCheckbox" tip="Automatyczne akceptowanie Łupów">Akceptowanie Łupów</label>'));
  185. $('body').append(mainBox);
  186. $('line > input[type="checkbox"]').css({
  187. margin: 'auto 3px'
  188. });
  189. this.saveSettings = function() {
  190. localStorage.lootfilterU = 'top:' + mainBox.offset().top + '|left:' + mainBox.offset().left + '|value:' + filterInput.val() + '|autoQuit:' + (autoQuitCheckbox.attr('checked') ? 1 : 0) + '|leg:' + (legendaryCheckbox.attr('checked') ? 1 : 0) + '|her:' + (heroicCheckbox.attr('checked') ? 1 : 0) + '|uni:' + (uniqueCheckbox.attr('checked') ? 1 : 0) + '|bless:' + (blessCheckbox.attr('checked') ? 1 : 0) + '|mix:' + (mixCheckbox.attr('checked') ? 1 : 0) + '|gold:' + (goldCheckbox.attr('checked') ? 1 : 0) + '|arrow:' + (arrowCheckbox.attr('checked') ? 1 : 0) + '|val:' + (valueCheckbox.attr('checked') ? 1 : 0) + '|tp:' + (tpCheckbox.attr('checked') ? 1 : 0) + '|runes:' + (runesCheckbox.attr('checked') ? 1 : 0) + '|tyton:' + (tytonCheckbox.attr('checked') ? 1 : 0)+ '|serce:' + (serceCheckbox.attr('checked') ? 1 : 0) + '|glowa:'+(glowaCheckbox.attr('checked') ? 1 : 0);
  191. };
  192. this.readSettings = function() {
  193. var settings = getCookie('lootfiltermbu');
  194. if (!!localStorage.lootfilterU) {
  195. var settings = localStorage.lootfilterU;
  196. }
  197. if (settings) {
  198. settings = settings.split('|');
  199. for (i = 0; i < settings.length; i++) {
  200. var pair = settings[i].split(':');
  201. switch (pair[0]) {
  202. case 'top':
  203. mainBox.css('top', pair[1] + 'px');
  204. break;
  205. case 'left':
  206. mainBox.css('left', pair[1] + 'px');
  207. break;
  208. case 'value':
  209. filterInput.val(pair[1]);
  210. break;
  211. case 'autoQuit':
  212. if (parseInt(pair[1]) == 1)
  213. autoQuitCheckbox.attr('checked', 'checked');
  214. break;
  215. case 'leg':
  216. if (parseInt(pair[1]) == 1)
  217. legendaryCheckbox.attr('checked', 'checked');
  218. break;
  219. case 'her':
  220. if (parseInt(pair[1]) == 1)
  221. heroicCheckbox.attr('checked', 'checked');
  222. break;
  223. case 'uni':
  224. if (parseInt(pair[1]) == 1)
  225. uniqueCheckbox.attr('checked', 'checked');
  226. break;
  227. case 'mix':
  228. if (parseInt(pair[1]) == 1)
  229. mixCheckbox.attr('checked', 'checked');
  230. break;
  231. case 'gold':
  232. if (parseInt(pair[1]) == 1)
  233. goldCheckbox.attr('checked', 'checked');
  234. break;
  235. case 'arrow':
  236. if (parseInt(pair[1]) == 1)
  237. arrowCheckbox.attr('checked', 'checked');
  238. break;
  239. case 'val':
  240. if (parseInt(pair[1]) == 1)
  241. valueCheckbox.attr('checked', 'checked');
  242. break;
  243. case 'tp':
  244. if (parseInt(pair[1]) == 1)
  245. tpCheckbox.attr('checked', 'checked');
  246. break;
  247. case 'runes':
  248. if (parseInt(pair[1]) == 1)
  249. runesCheckbox.attr('checked', 'checked');
  250. break;
  251. case 'bless':
  252. if (parseInt(pair[1]) == 1)
  253. blessCheckbox.attr('checked', 'checked');
  254. break;
  255. case 'tyton':
  256. if (parseInt(pair[1]) == 1)
  257. tytonCheckbox.attr('checked', 'checked');
  258. break;
  259. case 'serce':
  260. if (parseInt(pair[1]) == 1)
  261. serceCheckbox.attr('checked', 'checked');
  262. break;
  263. case 'glowa':
  264. if (parseInt(pair[1]) == 1)
  265. glowaCheckbox.attr('checked', 'checked');
  266. break;
  267. }
  268. }
  269. } else {
  270. legendaryCheckbox.attr('checked', 'checked');
  271. heroicCheckbox.attr('checked', 'checked');
  272. uniqueCheckbox.attr('checked', 'checked');
  273. mixCheckbox.attr('checked', 'checked');
  274. goldCheckbox.attr('checked', 'checked');
  275. arrowCheckbox.attr('checked', 'checked');
  276. valueCheckbox.attr('checked', 'checked');
  277. tpCheckbox.attr('checked', 'checked');
  278. runesCheckbox.attr('checked', 'checked');
  279. blessCheckbox.attr('checked', 'checked');
  280. tytonCheckbox.attr('checked', 'checked');
  281. serceCheckbox.attr('checked', 'checked');
  282. glowaCheckbox.attr('checked', 'checked');
  283. }
  284. };
  285. this.readSettings();
  286. var tmpLootboxItem = lootboxItem;
  287. var doubleSendBlock = false;
  288. lootboxItem = function(i) {
  289. tmpLootboxItem(i);
  290. var u = parseItemStat(i.stat);
  291. var limit = parseInt(filterInput.val());
  292. var tytonlimit = 5000;
  293. var glowalimit = 300;
  294. var sercelimit = 50000;
  295. if (((isNaN(limit) || (i.pr >= limit)) && valueCheckbox.attr('checked')) || (i.stat.search(/ttl/) >= 0 && blessCheckbox.attr('checked')) || (i.stat.search(/quest/) >= 0) || (i.stat.search(/legendary/) >= 0 && legendaryCheckbox.attr('checked')) || (i.stat.search(/heroic/) >= 0 && heroicCheckbox.attr('checked')) || (i.stat.search(/unique/) >= 0 && uniqueCheckbox.attr('checked')) || ((i.stat.search(/fullheal/) >= 0 || i.stat.search(/leczy/) >= 0 || i.stat.search(/perheal/) >= 0) && mixCheckbox.attr('checked')) || (i.stat.search(/ammo/) >= 0 && arrowCheckbox.attr('checked')) || (i.stat.search(/gold/) >= 0 && goldCheckbox.attr('checked')) || (i.stat.search(/teleport/) >= 0 && tpCheckbox.attr('checked')) || (i.stat.search(/runes/) >= 0 && runesCheckbox.attr('checked') || (i.pr == tytonlimit) && tytonCheckbox.attr('checked')) || ((i.pr == sercelimit) && serceCheckbox.attr('checked')) || ((i.pr == glowalimit) && glowaCheckbox.attr('checked'))) {
  296. if (g.party && !(isset(u.reqp) && u.reqp.indexOf(hero.prof) == -1)) {
  297. setLoots(i.id, "must");
  298. setStateOnOneLootItem(i.id, 2);
  299. }
  300. } else {
  301. setLoots(i.id, "not");
  302. setStateOnOneLootItem(i.id, 0);
  303. }
  304. if (!doubleSendBlock) {
  305. doubleSendBlock = true;
  306. setTimeout(function() {
  307. autoQuitCheckbox.attr('checked') ? sendLoots(1, false) : sendLoots(0, false);
  308. doubleSendBlock = false;
  309. }, 300);
  310. }
  311. }
  312. };
  313. g.loadQueue.push({
  314. fun: function() {
  315. var _lfu = new LootFilter();
  316. },
  317. data: ''
  318. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement