HRPG+

Improved Heroes RPG GUI

اعتبارا من 05-10-2015. شاهد أحدث إصدار.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

ستحتاج إلى تثبيت إضافة مثل 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);