HRPG+

Improved Heroes RPG GUI

От 05.10.2015. Виж последната версия.

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey, Greasemonkey или Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey или Violentmonkey.

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey или Userscripts.

За да инсталирате скрипта, трябва да инсталирате разширение като Tampermonkey.

За да инсталирате този скрипт, трябва да имате инсталиран скриптов мениджър.

(Вече имам скриптов мениджър, искам да го инсталирам!)

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

(Вече имам инсталиран мениджър на стиловете, искам да го инсталирам!)

// ==UserScript==
// @name        HRPG+
// @namespace   HRPG
// @description Improved Heroes RPG GUI
// @include     http://heroesrpg.com/game.php*
// @include     http://www.heroesrpg.com/game.php*
// @version     1
// @grant       none
// ==/UserScript==
t = document.createTextNode(
`Array.prototype.after = function (o){return this[this.indexOf(o)+1];}

String.prototype.replaceAt = function(n, t) {return this.substring(0, n) + t + this.substring(n + 1);}

function onlineHTML (name){
  online = false;
  $.ajax({type:'POST', url:'misc.php', data:{mod:'playersonlinelist'}, success:function(data) { 
		if($.map($('td',data.v),function(n){return n.textContent;}).indexOf(name) != -1) online = true;
  }, dataType:'json', async: false});
  if(online) return '[ONLINE]';
  return '<font color="#FFBBBB">[OFFLINE]</font>';
}

window.send_chat = function() {
	var msg = chatInputElem.val();
  if(msg.startsWith('/profile ')){
    viewPlayer(msg.slice(9));
    chatInputElem.val('');
    return;
  }
  if(msg.startsWith('/who ')){
    $.post('misc.php', {mod:'viewplayer', id:msg.slice(5)}, function(data) {
      array = $.map($('td',$('table',data.v).find('tbody')[0]),function(n){return n.textContent;});
      name = array.after(\'Name:\');
      msg =` + '`<td><font color="BBFFBB"><a href="javascript:m(\'${name}\');">${name}</a> - ${$(\'a\',data.v)[0].outerHTML} - Level ${array.after(\'Level:\')} - ${array.after(\'Nobility Rank:\')} - ${onlineHTML(name)} - <a href="javascript:viewPlayer(\'${name}\')">Profile</a></font></td>`' + `;
      $('#chat_table1').prepend('<tr id=\"ct1_tr'+(chatid1)+'\">'+msg+'</tr>');
			chatid1++;
	  }, 'json');
    chatInputElem.val('');
    return;
  }
  if(msg.startsWith('/misc ')){
    $.post('misc.php', {mod:'viewplayer', id:msg.slice(6)}, function(data) {
      array = $.map($('td',$('table',data.v).find('tbody')[0]),function(n){return n.textContent;});
      name = array.after(\'Name:\');
      msg =` + '`<td><font color="BBFFBB"><a href="javascript:m(\'${name}\');">${name}</a> - Battles: ${array.after(\'Battles:\')} - Battle Quests: ${array.after(\'Battle Quests:\')} - TS Quests ${array.after(\'TS Quests:\')}`' + `;
      $('#chat_table1').prepend('<tr id=\"ct1_tr'+(chatid1)+'\">'+msg+'</tr>');
			chatid1++;
	  }, 'json');
    chatInputElem.val('');
    return;
  }
  if(msg.startsWith('/crafting ')){
    $.post('misc.php', {mod:'viewplayer', id:msg.slice(6)}, function(data) {
      array = $.map($('td',$('table',data.v).find('tbody')[0]),function(n){return n.textContent;});
      name = array.after(\'Name:\');
      msg =` + '`<td><font color="BBFFBB"><a href="javascript:m(\'${name}\');">${name}</a> - Forging: ${array.after(\'Forging:\')} - Leatherworking: ${array.after(\'Leatherworking:\')} - Enchanting: ${array.after(\'Enchanting:\')} - Lockpicking: ${array.after(\'Lockpicking:\')} - Jewelcrafing: ${array.after(\'Jewelcrafting:\')}`' + `;
      $('#chat_table1').prepend('<tr id=\"ct1_tr'+(chatid1)+'\">'+msg+'</tr>');
			chatid1++;
	  }, 'json');
    chatInputElem.val('');
    return;
  }
  if(msg.startsWith('/gathering ')){
    $.post('misc.php', {mod:'viewplayer', id:msg.slice(6)}, function(data) {
      array = $.map($('td',$('table',data.v).find('tbody')[0]),function(n){return n.textContent;});
      name = array.after(\'Name:\');
      msg =` + '`<td><font color="BBFFBB"><a href="javascript:m(\'${name}\');">${name}</a> - Hunting: ${array.after(\'Hunting:\')} - Mining: ${array.after(\'Mining:\')} - Woodcutting: ${array.after(\'Woodcutting:\')} - Quarrying: ${array.after(\'Quarrying:\')}`' + `;
      $('#chat_table1').prepend('<tr id=\"ct1_tr'+(chatid1)+'\">'+msg+'</tr>');
			chatid1++;
	  }, 'json');
    chatInputElem.val('');
    return;
  }
  if(msg.startsWith('/g ')){
    msg.replaceAt(2,'c');
  }
	 $.post('chat.php', {mod:'send', msg:msg}, function(data) {
		 if(!data.err) {
			 if(data.addignore) {
				 ignored.push(data.addignore);
			 }
			 if(data.remignore) {
				 ignored.splice(ignored.indexOf(data.remignore, 1));
			 }
			 chatInputElem.val('');
			 chatinactivity = 0;
			 update_chat(0);
		 } else { displayError(data.err); }
	 }, 'json');
}

window.bRightSelect = function() {
	var mod = $('#bright_select').val();
	$.post('displayr.php', {mod:mod}, function(data) {
    $('#bright_content').html(data.html);
    if($('select#bright_select')[0].options[$('select#bright_select')[0].selectedIndex].text == 'Items') {
      $('#bright_content').html($('#bright_content').html().replace(/\\[<a href="javascript:openChest\\((\\d),1\\)">Open<\\/a>\\]/g,'<a href="javascript:craftPickLock($1,1)">P</a> <a href="javascript:craftPickLock($1,2)">10</a> <a href="javascript:openChest($1,1)">O</a>'));
    }
  }, 'json');
}`);
s = document.createElement('script');
s.appendChild(t);
$('body').append(s);