Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name MouseMagelee 0.85
- // @namespace hentaiverse.org
- // @match *://*.hentaiverse.org/*
- // @run-at document-end
- // @grant none
- // ==/UserScript==
- // ***THANKS***
- // sickentide (HV No Popup)
- // sigo8 (Reloader Shim)
- // SETTINGS
- var hideLog = true;
- var defaultAction = [163,162,161]; //var defaultAction =0 for melee
- var minHP = 0.35;
- var minMP = 0.2;
- var minSP = 0.3;
- var rightClick = [311,313];
- var log = document.querySelector('#textlog > tbody');
- var paneCompletion = document.getElementById('pane_completion');
- function canCast(id){
- var el = document.getElementById(id);
- return !!el && el.hasAttribute('onclick');
- }
- function setSpellAttack(id) {
- var caller = document.getElementById(id);
- window.battle.lock_action(caller, 1, 'magic', id);
- window.battle.set_hostile_skill(id);
- }
- function castSupport(id) {
- var caller = document.getElementById(id);
- window.battle.lock_action(caller, 1, 'magic', id);
- window.battle.set_friendly_skill(id);
- window.battle.touch_and_go();
- }
- function runRightClickSpell() {
- for (var i = 0; i < rightClick.length; i++) {
- if (canCast(rightClick[i])) {
- castSupport(rightClick[i]);
- return;
- }
- }
- }
- function showGem() {
- var gem = document.getElementById('ikey_p');
- var gem_icon = document.getElementById('gem_icon');
- if (gem && !gem_icon) {
- var icon;
- switch (document.querySelector('#ikey_p > div > div').innerHTML.match(/([^\s]+) Gem/)[1]) {
- case 'Mystic':
- icon = 'channeling.png';
- break;
- case 'Health':
- icon = 'healthpot.png';
- break;
- case 'Mana':
- icon = 'manapot.png';
- break;
- case 'Spirit':
- icon = 'spiritpot.png';
- break;
- }
- gem_icon = document.getElementById('pane_effects').appendChild(document.createElement('img'));
- gem_icon.src = '/y/e/' + icon;
- gem_icon.style.cssText = 'float: right;margin-right: 565px;';
- function useGem(){
- window.battle.lock_action(gem, 1, 'items', 'ikey_p');
- window.battle.set_friendly_skill('999');
- window.battle.touch_and_go();
- gem.remove(); //probably useless
- gem_icon.remove();
- }
- gem_icon.onclick = useGem;
- gem_icon.onmouseover = useGem;
- gem_icon.id = "gem_icon";
- } else if (!gem && gem_icon) {
- gem_icon.remove();
- }
- }
- function reloadedEvent() {
- showGem();
- if(document.querySelector('#vbh img').width < 496*minHP) return;
- if(document.querySelector('#vbm img').width < 207*minMP) return;
- if(document.querySelector('#vbs img').width < 207*minSP) return;
- if(defaultAction){
- for (var i = 0; i < defaultAction.length; i++) {
- if (canCast(defaultAction[i])) {
- setSpellAttack(defaultAction[i]);
- break;
- }
- }
- }
- mpane = document.getElementById('pane_monster');
- var m = mpane.getElementsByClassName("btm1");
- for (var j = 0; j < m.length; j++) {
- if (m[j].hasAttribute('onclick')) {
- m[j].setAttribute('onmouseover', m[j].getAttribute('onclick'));
- }
- }
- }
- function roundEndEvent() {
- var btcp = document.getElementById('btcp');
- if (btcp){
- if(document.querySelector('img[src$="finishbattle.png"]')){
- var endSheet = document.createElement('style');
- endSheet.innerHTML = '#btcp {display: block !important}';
- document.head.appendChild(endSheet);
- }
- else{
- btcp.click();
- }
- }
- }
- function init() {
- if(!log) {
- return;
- }
- var obs = new MutationObserver(reloadedEvent);
- obs.observe(log, {childList: true});
- var obs2 = new MutationObserver(roundEndEvent);
- obs2.observe(paneCompletion, {childList: true});
- var sheet = document.createElement('style');
- sheet.innerHTML = '#btcp {display: none}';
- if(hideLog){
- sheet.innerHTML += '#pane_log {display: none}';
- }
- document.head.appendChild(sheet);
- window.addEventListener('contextmenu', function (e) {
- e.preventDefault();
- runRightClickSpell();
- }, false);
- reloadedEvent();
- }
- init();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement