HRPG+

Improved Heroes RPG GUI

Per 05-10-2015. Zie de nieuwste versie.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey, Greasemonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Userscripts.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een gebruikersscriptbeheerder nodig.

(Ik heb al een user script manager, laat me het downloaden!)

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

(Ik heb al een beheerder - laat me doorgaan met de installatie!)

// ==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);