|
|
|
HV Script Thread, Discuss your creations. Includes guidelines and infos for script creation (2020-02-28 upd) |
|
Mar 31 2013, 19:31
|
sylprate
Newcomer
Group: Members
Posts: 30
Joined: 11-March 13
|
Hi. I got a problem for using magic score script.
Just it doesn't happen when I press C key.
1. I use chrome 26(newest) 2. I use Tampermonkey and all scripts are in there. 3. I try re-install script and turn off other scripts. 4. other comparison script are working. Script that using qwer. 5. I use version of 2.0.1, midori's newest version, maybe. 6. Already try caps lock on and off. 7. When I compare working and not-working script, both use same function that var key = String.fromCharCode(e.keyCode).toLowerCase(); 8. I try to install script as chrome extension.
I don't know why Is not working. Please help me.
|
|
|
|
|
|
Mar 31 2013, 19:36
|
Lement
Group: Members
Posts: 2,977
Joined: 28-February 12
|
It uses S key and ChosenUno updated it since midori's had problem with crit iirc. Don't forget to check your character page and equipment screen before use.
This post has been edited by Lement: Mar 31 2013, 19:37
|
|
|
Mar 31 2013, 19:49
|
sylprate
Newcomer
Group: Members
Posts: 30
Joined: 11-March 13
|
ChosenUno? what is that?
Check my pages? I can't get it.
My problem is just nothing happen when I press s key, now.
|
|
|
Apr 1 2013, 01:34
|
Lement
Group: Members
Posts: 2,977
Joined: 28-February 12
|
ChosenUno is an user upstanding member of the community. Posted his version in this very thread. Since magic scores compares to your equipment and profs, you must check your character page and equipment screen before trying to get scores. This post has been edited by Lement: Apr 1 2013, 01:34
|
|
|
Apr 1 2013, 04:25
|
sylprate
Newcomer
Group: Members
Posts: 30
Joined: 11-March 13
|
I already check my pages. Is there more action than show my equip?
still not working.
|
|
|
|
|
|
Apr 1 2013, 05:11
|
Lement
Group: Members
Posts: 2,977
Joined: 28-February 12
|
I usually mouse over my equipment screen although that shouldn't be strictly necessary with right writing....Did you try with all other extensions turned off? Anyway, here's what I'm using right now: CODE // ==UserScript== // @name HV - Magic Scores // @namespace lalala // @description Displays a list of magic scores. Score = MDB * (1+EDB/100) * (1+prof/200) * (1 + crit/200) // @match http://hentaiverse.org/?s=Bazaar&ss=es* // @match http://hentaiverse.org/?s=Character&ss=eq* // @match http://hentaiverse.org/pages/showequip.php?eid=*&key=* // @match http://hentaiverse.org/?s=Bazaar&ss=fr* // @match http://hentaiverse.org/?s=Battle&ss=iw* // @match http://hentaiverse.org/?s=Character&ss=* // @match http://hentaiverse.org/ // @version 2.0 // @run-at document-end // ==/UserScript==
var useCritChance = true;
/* * * * * * * * * * * * * * * * * * * * * * * */
// fix statistics pane (v1 used to do that) if (document.getElementById('stats_pane')) { var style = document.createElement('style'); style.innerHTML = '#stats_pane > div { height: auto !important; }'; document.head.appendChild(style); }
if (!document.querySelector('.eqde, .eqdp, #equipment')) return;
/* * * * * * * * * * * * * * * * * * * * * * * */
var Parser = {
parse: function(source) { // decorator for _parseObject if (source != null && source.constructor == String) { var tokens = source.match(/'.+?'/g), temp = document.createElement('div'); temp.innerHTML = tokens[2].slice(1,tokens[2].length-1); var result = Parser._parseObject(temp.firstElementChild); result.Info.Name = tokens[1].slice(1,tokens[1].length-1); return result; } if (document.getElementById('equipment')) { var result = Parser._parseObject(document.querySelector('#equipment > div:first-child')); result.Info.Name = document.querySelector('div').textContent; return result; } var popup = document.getElementById('popup_box'); if (popup.childElementCount) { var result = Parser._parseObject(document.querySelector('#popup_box > div + div > div')); result.Info.Name = document.querySelector('#popup_box > div').textContent; return result; } }, _hasChildren: function(object) { if (!object) return false; for (var x in object) return true; return false; }, _filterSection: function(section,name) { if (!section) return null; if (name == 'Spell Damage' || name == 'Info') return section; var allowed = name == 'Stats' ? ['Magic Damage','Magic Critical'] : name == 'Proficiency' ? ['Elemental','Divine','Forbidden'] : name == 'Primary Attributes' ? ['Intelligence','Wisdom'] : null; if (!allowed) return null; else for (var x in section) { if (allowed.indexOf(x) == -1) delete section[x]; } if (!Parser._hasChildren(section)) return null; return section; },
_parseObject: function(source) { if (source.constructor == String) { var temp = document.createElement('div'); temp.innerHTML = source; return parseObject(temp); } var res = { Info: { } }, n = source.childNodes.length; var section = null, sectionContents = { }; for (var i=0;i<n;i++) {
var child = source.childNodes[i]; // check for equipment info if (child.firstElementChild.nodeName == 'STRONG') { if (child.textContent.indexOf('Level') != -1) { // type, level and EXP var tokens = child.textContent.match(/^(.+?)\s+Level (\d+)\s+(.+)$/); res.Info.Type = tokens[1]; } continue; } // check for section name if (!child.firstElementChild.childElementCount && child.textContent.trim().length) { var temp = Parser._filterSection(sectionContents,section || 'Stats'); if (Parser._hasChildren(temp)) // previous section or stats res[section||'Stats'] = temp; // clone section = child.firstElementChild.textContent; sectionContents = { }; } if (section && !/(Spell Damage|Proficiency|Primary Attributes)/.test(section)) continue;
// retrieve section contents var targets = child.getElementsByTagName('div'), target = null, attributeName = null, attributeValue = null;
for (var j=0;j<targets.length;j++) { target = targets[j]; if (target.firstElementChild && target.firstElementChild.nodeName == 'DIV') continue; if (target.textContent.length == 0) continue; if (target.textContent.trim()[0] == '%') continue;
target = target.textContent.split('+') if (target.length > 1 && target[0].length > 0 && target[1].length > 0) { attributeName = target[0].trim(); attributeValue = target[1].trim(); sectionContents[attributeName] = parseFloat(attributeValue); } else { if (target.length == 1 || target[0].length > 0) // attribute name attributeName = target[0]; else { // attribute value attributeValue = target[1]; sectionContents[attributeName] = parseFloat(attributeValue); } } } } var temp = Parser._filterSection(sectionContents,section || 'Stats'); if (Parser._hasChildren(temp)) // previous section or stats res[section||'Stats'] = temp; // clone return res;
} };
/* * * * * * * * * * * * * * * * * * * * * * * */
var Cruncher = {
_computeScore: function(magicDamage, EDB, proficiency, critChance) { return magicDamage * (1 + proficiency/200) * (1 + EDB/100) * (useCritChance ? (1 + critChance * 0.5) : 1); }, _getTotalStat: function(stat,multiplicative) { // multiplicative = false => returns stat1+stat2+stat3 // multiplicative = true => returns (1-stat1)*(1-stat2)*... var result = multiplicative ? 1 : 0; for (var x in Cruncher.data.equipment) { for (var y in Cruncher.data.equipment[x]) { if (y != stat) continue; if (multiplicative) result *= (1 - Cruncher.data.equipment[x][y]/100); else result += Cruncher.data.equipment[x][y]; } } return result; },
update: function(overwrite) { function isEqual(obj1, obj2) { for (var x in obj1) { if (!obj2[x]) return false; for (var y in obj1[x]) { if (!obj2[x].hasOwnProperty(y) || obj2[x][y] != obj1[x][y]) return false; } } return true; } // reset Cruncher.data = JSON.parse(JSON.stringify(Cruncher.originalData)); // clone if (!overwrite) return; var slot = Controller._extractSlot(overwrite.Info.Name,overwrite.Info.Type); var target = Cruncher.data.equipment[slot] || { }; if (isEqual(overwrite,target)) return; // update primary attributes if (!overwrite['Primary Attributes']) overwrite['Primary Attributes'] = { }; if (!target['Primary Attributes']) target['Primary Attributes'] = { }; ['Intelligence','Wisdom'].forEach(function(stat) { Cruncher.data.player.attributes[stat] += (overwrite['Primary Attributes'][stat] || 0) - (target['Primary Attributes'][stat] || 0); Cruncher.data.player.attributes[stat] = Math.max(0,Cruncher.data.player.attributes[stat]); }); // update proficiencies if (!overwrite.Proficiency) overwrite.Proficiency = { }; if (!target.Proficiency) target.Proficiency = { }; ['Elemental','Divine','Forbidden'].forEach(function(prof) { Cruncher.data.player.proficiencies[prof] += (overwrite.Proficiency[prof] || 0) - (target.Proficiency[prof] || 0); Cruncher.data.player.proficiencies[prof] = Math.max(0,Cruncher.data.player.proficiencies[prof]); }); // update EDB if (!overwrite['Spell Damage']) overwrite['Spell Damage'] = { }; if (!target['Spell Damage']) target['Spell Damage'] = { }; ['Fire','Cold','Elec','Wind','Holy','Dark','Soul'].forEach(function(EDB) { Cruncher.data.player.EDB[EDB] += (overwrite['Spell Damage'][EDB] || 0) - (target['Spell Damage'][EDB] || 0); Cruncher.data.player.EDB[EDB] = Math.max(0,Cruncher.data.player.EDB[EDB]); }); // update critical if (!overwrite.Stats) overwrite.Stats = { }; if (!target.Stats) target.Stats = { }; if (overwrite.Stats['Magic Critical'] || target.Stats['Magic Critical']) { var temp = 1-Cruncher.data.player.critical; temp /= 1 - (target.Stats['Magic Critical'] || 0)/100; temp *= 1 - (overwrite.Stats['Magic Critical'] || 0)/100; Cruncher.data.player.critical = 1-temp; } // update object Cruncher.data.equipment[slot] = overwrite; },
_getMagicDamage: function() { if (!Cruncher.data) Cruncher.update(); if (!Cruncher.data.equipment.Main.Stats) Cruncher.data.equipment.Main.Stats = { }; var weaponName = Cruncher.data.equipment.Main.Info; if (weaponName) weaponName = weaponName.Name; else weaponName = '';
return (Cruncher.data.equipment.Main.Stats['Magic Damage'] || 0) + Cruncher.data.player.attributes.Intelligence * 2 + Cruncher.data.player.attributes.Wisdom + (/ Staff /i.test(weaponName) ? (Cruncher.data.player.proficiencies.Staff/2) : 0); },
getScores: function() { if (!Cruncher.originalData) return; if (!Cruncher.data) Cruncher.update(); var result = { }; var MDB = Cruncher._getMagicDamage(); var proficiencies = Cruncher.data.player.proficiencies; ['Fire','Cold','Elec','Wind','Holy','Dark','Soul'].forEach(function(EDB) { var proficiency = EDB == 'Holy' ? (proficiencies.Divine || 0) : EDB == 'Dark' ? (proficiencies.Forbidden || 0) : EDB == 'Soul' ? 0.5 * ( (proficiencies.Divine || 0) + (proficiencies.Forbidden || 0) ) : (proficiencies.Elemental || 0); result[EDB] = Cruncher._computeScore( MDB, Cruncher.data.player.EDB[EDB], proficiency, Cruncher.data.player.critical ); }); return result; }
};
/* * * * * * * * * * * * * * * * * * * * * * * */
var Controller = {
_extractSlot: function(name,slot) { if (/Weapon|Staff/i.test(slot)) return 'Main'; if (/Shield/i.test(slot)) return 'Off'; if (/Cap|Helm|Coif/i.test(name)) return 'Helmet' if (/Robe|Armor|Breastplate|Cuirass|Hauberk/i.test(name)) return 'Body'; if (/Gloves|Gauntlets|Mitons/i.test(name)) return 'Hands'; if (/Pants|Leggings|Greaves|Chausses/i.test(name)) return 'Legs'; return 'Feet'; },
saveData: function() { function getStat(section,stat) { if (getStat.characterMap) { section = section.split('').reverse().join(''); stat = stat.split('').reverse().join(''); } var result = getStat.statistics.match(new RegExp(section + '(?:.|\n)+?' + stat + '\\n.+?([\\dnone\.]+)','i'))[1]; if (/None|enoN/i.test(result)) return 0; return parseFloat(getStat.characterMap ? result.split('').reverse().join('') : result); } var data; if (/slot/.test(window.location.href) && localStorage.hasOwnProperty('scoreData')) data = JSON.parse(localStorage.getItem('scoreData')); else data = { player: { }, equipment: { } }; // equipment Array.prototype.slice.call(document.querySelectorAll('.eqde'),0).forEach(function(x) { var item = Parser.parse(x.getAttribute('onmouseover')); var slot = Controller._extractSlot(item.Info.Name,item.Info.Type); data.equipment[slot] = item; }); if (!data.equipment.Main) data.equipment.Main = { }; // player stats if (!document.querySelector('.f10rb')) // custom font engines getStat.statistics = document.getElementById('stats_pane').textContent; else { // default font engine getStat.characterMap = '0123456789.,!?%+-=/\'":;()[]- abcdefghijklmnopqrstuvwxyz'; getStat.statistics = document.getElementById('stats_pane').innerHTML; var regex = /<div class="f(\d+)[lr]b" style="width:\d+px; background-position:0px -(\d+)px"><\/div>/gi; getStat.statistics = getStat.statistics.replace(regex,function(match,multiplier,offset) { return getStat.characterMap[(+offset)/(+multiplier)]; }).replace(/<.+?>/g,''); } data.player.proficiencies = { }; ['Staff','Elemental','Divine','Forbidden'].forEach(function(x) { data.player.proficiencies[x] = getStat('Effective Proficiency',x); }); data.player.EDB = { }; ['Fire','Cold','Elec','Wind','Holy','Dark','Soul'].forEach(function(x) { data.player.EDB[x] = getStat('Spell Damage Bonus',x); }); data.player.attributes = { }; ['Intelligence','Wisdom'].forEach(function(x) { data.player.attributes[x] = getStat('Primary Attributes',x); }); data.player.critical = parseFloat(getStat.statistics.match(/magical(?:.|\n)+?([\d\.]+) % crit chance/i)[1])/100; // original scores Cruncher.originalData = data; data.scores = Cruncher.getScores(); localStorage.setItem('scoreData',JSON.stringify(data)); }, loadData: function() { var data = JSON.parse(localStorage.getItem('scoreData')); if (!data) return; Cruncher.originalData = data; }, getTarget: function() { return document.querySelector('#popup_box > div + div > div, #equipment > div'); }, keyEvent: function(e) { function getColor(n) { if (showOriginal) return '#5C0D11'; if (n > 0) return 'darkgreen'; if (n < 0) return 'red'; return 'dodgerblue'; } var key = String.fromCharCode(e.keyCode).toLowerCase(); if (key != 's') return; var source = Parser.parse(), slot = Controller._extractSlot(source.Info.Name,source.Info.Type); Cruncher.update(source); if (document.getElementById('MagicScores') != null) { Controller.lastResult.parentNode.removeChild(Controller.lastResult); Controller.getTarget().style.display = null; return; } var scores = Cruncher.getScores(), differentialScores = { }, showOriginal = true; for (var x in Cruncher.originalData.scores) { differentialScores[x] = parseInt(scores[x] - Cruncher.originalData.scores[x],10); scores[x] = parseInt(scores[x]); // for showOriginal if (differentialScores[x] != 0) showOriginal = false; } if (showOriginal) differentialScores = scores; var div = document.createElement('div'); div.id = 'MagicScores'; var HTML = '<div style="text-align: center; font-size: 120%;">Magic Scores</div>' + '<div style="border-top:1px solid #A47C78; margin:5px auto 2px; padding-top:2px">'; for (var x in differentialScores) { HTML += '<div style="float:left; width:155px; text-align:right"><div style="float:left; width:99px; padding:2px">' + x + '</div><div style="float:left; width:35px; padding:2px 0 2px 2px">' + '<strong style="color: ' + getColor(differentialScores[x]) + '">' + (differentialScores[x] >= 0 ? '+' : '' ) + differentialScores[x] + '</strong></div></div>'; } HTML += '</div><div style="clear:both">' div.innerHTML = HTML; var target = Controller.getTarget(); target.parentNode.insertBefore(div,target.nextSibling); target.style.display = 'none'; Controller.lastResult = div; } };
/* * * * * * * * * * * * * * * * * * * * * * * */
if (/ss=eq/.test(window.location.href)) Controller.saveData(); else Controller.loadData();
if (Cruncher.originalData) window.addEventListener('keyup',Controller.keyEvent,false);
|
|
|
|
|
|
Apr 1 2013, 05:39
|
sylprate
Newcomer
Group: Members
Posts: 30
Joined: 11-March 13
|
Thanks, but still not work.
I try turn off all extension except monkey, and turn off all script except magic score, of course I replace script as your.
And look my character page and equipment page, hovering all equipment.
Not working, I really don't know why it is not working.
|
|
|
Apr 1 2013, 05:45
|
sylprate
Newcomer
Group: Members
Posts: 30
Joined: 11-March 13
|
Anyway, I saw another computers are work.
I will re-install my chrome, or windows, thank you Lement.
|
|
|
Apr 3 2013, 02:22
|
Lement
Group: Members
Posts: 2,977
Joined: 28-February 12
|
Can I see the script for making equipment in forums have a mouseover?
I'm curious in making equip links get magic scores automatically, but am not quite sure how to fetch the data.
|
|
|
|
|
|
Apr 6 2013, 19:37
|
k-kirei
Newcomer
Group: Recruits
Posts: 17
Joined: 25-March 13
|
HV Equipment HighlightsI tried using the Bazaar Highlights. I like the mod concept for quickly skimming the bazaar items for good items. However, I was a little bit annoyed with the fact that: - The mod breaks on multi-line equipment name.
- It required the use of local font, which breaks various HV layout. (srsly Tenboro, fix the layout using Verdana / Arial pl0x)
- It breaks click-highlight on equipment purchase selection.
- It also breaks HV Stat on Bazaar screen, I think?
Hence I coded from scratch for an equipment highlighter that I like. Mod features: - Highlight the entire <div> so it is more noticeable (and so it doesn't glitch on long equipment name).
- You can add your own keywords easily as well, like the previous Bazaar Highlights.
- Can use HV font engine.
- Since it uses <div> highlighting, the text color changes equipment click / purchase selection.
- Extra: also highlights on your inventory and equipment selection.
Enjoy. (IMG:[ i45.tinypic.com] http://i45.tinypic.com/2emep7k.png) p.s. Forgive my noobness for using jQuery. I <3 Konata. v1.1.0 Removed jQuery dependency. Added highlight for Forge and Item World
HVEQLights_110.zip ( 902bytes )
Number of downloads: 85v1.0.1 FIXED: Mispelled Artic --> Arctic Added: Also highlights equipped item. It's fun having full Exquisite highlight on your equipment list. This post has been edited by k-kirei: Apr 6 2013, 23:03
|
|
|
|
|
|
Apr 6 2013, 20:34
|
Lement
Group: Members
Posts: 2,977
Joined: 28-February 12
|
Frameworks like jquery are ok when in battle, just remember to turn them off when you fight ;D. Good practice otherwise.
But here's a tip: see that onmouseover popping up in bazaar, forge and equipment selection? That's an inline function. This means that you can use your js or even pure css to highlight based on all equipment data - like, for example, only highlight phases with INT and WIS.
This post has been edited by Lement: Apr 6 2013, 20:35
|
|
|
|
|
|
Apr 6 2013, 20:43
|
k-kirei
Newcomer
Group: Recruits
Posts: 17
Joined: 25-March 13
|
QUOTE(Lement @ Apr 7 2013, 01:34) Frameworks like jquery are ok when in battle, just remember to turn them off when you fight ;D. Good practice otherwise.
But here's a tip: see that onmouseover popping up in bazaar, forge and equipment selection? That's an inline function. This means that you can use your js or even pure css to highlight based on all equipment data - like, for example, only highlight phases with INT and WIS.
I was using that equipment pop-up information data. Initially I intended to use pure JS (GetElementByClassName) for accessing the div with .eqdp class. But for some reason, the Item NodeList cannot be accessed. After debugging for over an hour, I gave up and just threw some jQuery. Probably if you know the pure JS workaround, you can modify the code and upload it. I used match/include only to bazaar, inventory and character equipment page. I think it shouldn't affect battle performance. This post has been edited by k-kirei: Apr 6 2013, 20:50
|
|
|
|
|
|
Apr 6 2013, 20:52
|
Lement
Group: Members
Posts: 2,977
Joined: 28-February 12
|
Even if it throw in functions that you never access in your js your battle performance still deteriorates.
And oh yeah, perhaps something to do with it grabbing a function?
|
|
|
|
|
|
Apr 6 2013, 22:44
|
k-kirei
Newcomer
Group: Recruits
Posts: 17
Joined: 25-March 13
|
Removed the jQuery dependency. (IMG:[ invalid] style_emoticons/default/ph34r.gif) I made another one below. Tested with Calibri, Arial and Verdana. CODE // ==UserScript== // @name HV Custom Font Fix // @namespace HVCustomFontFix // @description Fixes custom font behaviors // @match http://hentaiverse.org/?s=Character&ss=ch* // @match http://hentaiverse.org/?s=Character&ss=eq* // @version 1.0.0 // @run-at document-end // ==/UserScript==
(function() { var statspane = document.getElementById("stats_pane").childNodes; statspane[3].style.height = "auto"; statspane[5].style.height = "auto"; statspane[7].style.height = "auto"; //end })();
I still can't fix the Monster Lab font glitch. But eh, I rarely go there. I'll leave it for now. This post has been edited by k-kirei: Apr 6 2013, 22:46
|
|
|
|
|
|
Apr 14 2013, 20:49
|
Tyrlidd
Newcomer
Group: Members
Posts: 70
Joined: 28-October 10
|
Using the HentaiVerse Equipment Comparison from the wiki. Worked fine for a while, but now it compares everything, that is not a weapon, to my boot slot whenever I try to compare on a page like this http://hentaiverse.org/pages/showequip.php...;key=4e882117b2. Any ideas on how to fix it? Happens on Firefox and Nightly.
|
|
|
Apr 20 2013, 16:07
|
Ichy
Group: Catgirl Camarilla
Posts: 13,061
Joined: 19-February 09
|
I just installed the magic Score Script.. Where do I see my Magic Score?
/edit: oooooh S
This post has been edited by Ichy: Apr 20 2013, 16:34
|
|
|
Apr 20 2013, 16:34
|
varst
Group: Gold Star Club
Posts: 11,561
Joined: 30-March 10
|
QUOTE(Ichy @ Apr 20 2013, 22:07) I just installed the magic Score Script.. Where do I see my Magic Score?
It's the 'S' button. (So don't use that in the forging screen) This post has been edited by varst: Apr 20 2013, 16:34
|
|
|
Apr 21 2013, 02:36
|
letmegitdat
Group: Members
Posts: 279
Joined: 5-January 09
|
does any have HV keybinds 2.4.1
AND
multiple quickbars
working together? if I turn one off the other works...
i'm guessing they are both listening for keyup/down events?
|
|
|
Apr 21 2013, 05:34
|
ChosenUno
Group: Gold Star Club
Posts: 4,170
Joined: 23-February 10
|
QUOTE(letmegitdat @ Apr 21 2013, 07:36) does any have HV keybinds 2.4.1
AND
multiple quickbars
working together? if I turn one off the other works...
i'm guessing they are both listening for keyup/down events?
Pretty much.
|
|
|
3 User(s) are reading this topic (3 Guests and 0 Anonymous Users)
0 Members:
|
|
|
|
|