Welcome Guest ( Log In | Register )

291 Pages V « < 28 29 30 31 > »   
Reply to this topicStart new topic
> HV Script Thread, Discuss your creations. Includes guidelines and infos for script creation (2020-02-28 upd)

 
post Feb 22 2013, 04:58
Post #568
n125



Elite Poster
*********
Group: Gold Star Club
Posts: 6,282
Joined: 23-May 08
Level 500 (Godslayer)


Yeah, I think there's something definitely wrong with midori's Magic Scores script fix.

This gives me higher magic scores in all elements than this, despite the EDB, INT, and WIS being significantly lower. This is the second time this happened to me; the first time was with pants, where the EDB, INT, and WIS were also lower than what I had equipped. So, I'm guessing that this bug only occurs when comparing armor, since that's where the original script broke in the first place.

Browser doesn't matter.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Mar 1 2013, 05:06
Post #569
midori_



中文玩家
*****
Group: Members
Posts: 584
Joined: 29-February 12
Level 304 (Godslayer)


QUOTE(midori_ @ Jan 22 2013, 16:06) *

Thanks to the "The Evil Phoenix" post the "hv_equip_compare.user.js"
After I compare this with the old version , I find the key to fix the other script "magicscores2".
Now I have these two script working as usual.
Here is the new one.
Attached File  magicscores2_Edited.user.zip ( 4.24k ) Number of downloads: 626



hmmm... (IMG:[invalid] style_emoticons/default/dry.gif)

By someone's complain, I find a problem about magicscores2 which I edited.
In the battle, this problem may cause pointless delay. (IMG:[invalid] style_emoticons/default/cry.gif)

Here the fixed version.
Attached File  magicscores2_Edited.user.js.zip ( 4.12k ) Number of downloads: 152



Explan :
The function of this script is alright , but I make a mistake when copy&paste to apply it.
And it makes the magicscores2 will always be running.
(Even though it is pointless.)
Attached Image ___ Attached Image


QUOTE(n125 @ Feb 22 2013, 10:58) *

This gives me higher magic scores in all elements than this, despite the EDB, INT, and WIS being significantly lower.


This changed should be helped. ( or take the fixed version here)
Attached Image ---------> Attached Image
Because the calculation make a mistake during comparison when considering the critical strike damage bonus.
The score of equip (Not equipped) will be multiplied by (1 + crit/200).
But the score of equip (Equipped) won't.
So it always make a junk into good-looking.
I have no idea how to deal with it.

This post has been edited by midori_: Mar 1 2013, 06:39
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Mar 1 2013, 06:58
Post #570
n125



Elite Poster
*********
Group: Gold Star Club
Posts: 6,282
Joined: 23-May 08
Level 500 (Godslayer)


QUOTE(midori_ @ Feb 28 2013, 19:06) *

Because the calculation make a mistake during comparison when considering the critical strike damage bonus.
The score of equip (Not equipped) will be multiplied by (1 + crit/200).
But the score of equip (Equipped) won't.
So it always make a junk into good-looking.
I have no idea how to deal with it.


Thanks, but, even if I set useCritChance = false, it still happens. :\
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Mar 1 2013, 07:13
Post #571
ChosenUno



A Legendary Collector
********
Group: Gold Star Club
Posts: 4,170
Joined: 23-February 10
Level 422 (Godslayer)


QUOTE(n125 @ Mar 1 2013, 11:58) *

Thanks, but, even if I set useCritChance = false, it still happens. :\


Visit both your character page and your equipment page. After that, try again. Does it work?

If not, try my version over here: [github.com] https://github.com/trandoanhung1991/HV-magicscore
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Mar 1 2013, 07:26
Post #572
n125



Elite Poster
*********
Group: Gold Star Club
Posts: 6,282
Joined: 23-May 08
Level 500 (Godslayer)


QUOTE(ChosenUno @ Feb 28 2013, 21:13) *

Visit both your character page and your equipment page. After that, try again. Does it work?


Nope.

QUOTE(ChosenUno @ Feb 28 2013, 21:13) *
If not, try my version over here: [github.com] https://github.com/trandoanhung1991/HV-magicscore


This appears to work, both with and without useCritChance. Thanks. (IMG:[invalid] style_emoticons/default/tongue.gif)
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Mar 1 2013, 15:33
Post #573
ChosenUno



A Legendary Collector
********
Group: Gold Star Club
Posts: 4,170
Joined: 23-February 10
Level 422 (Godslayer)


QUOTE(n125 @ Mar 1 2013, 12:26) *

Nope.
This appears to work, both with and without useCritChance. Thanks. (IMG:[invalid] style_emoticons/default/tongue.gif)


Yay me! (IMG:[invalid] style_emoticons/default/biggrin.gif)
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Mar 2 2013, 14:12
Post #574
Kelenius



Casual Poster
***
Group: Members
Posts: 154
Joined: 16-March 12
Level 332 (Godslayer)


Aright, I think it had enough testing.

Attached File  HV_Shop_Filter.user.zip ( 12.79k ) Number of downloads: 69


This script can filter items in the shop based on quality, class, type, tier, suffix and prefix. You can also save your filters to apply them later with one click.

This is how it works: when you'll install it, a text field would appear at the bottom of the shop screen. Type the filter here and press "Get line". It will only leave equipment that matches the filter.

To save a filter, press "Set" at the slot you want to use, and type your filter in the field. It can be deleted or modified later. A new slot would appear any time you use one.

Here's a list of filters you can use:
  • Exact quality: q0, q1, q2, etc, up to 7. Will only show items with this quality, e.g. q2 will only leave fair quipment.
  • Quality in range: q4+, q2-, q6+, etc. q4+ will show items of Superior quality and above. q4- will show items of Superior quality and below.
  • Tier: tier1, tier23, tier13, etc.
  • Class: c1H2H to show only one-handed and two-handed weapons. -c1H2H to show everything except one-handed and two-handed weapons.
  • Type: tAxeClub to show only axes and clubs, -tAxeClub to show everything expect them.
  • Suffix: sFocusSlaughter to show only equipment with those suffixes. -sFocusSlaughter to show equipment without those suffixes.
  • Prefix: eNoneFiery to show only equips without any prefix or with "Fiery" prefix, -eNoneFiery for opposite effect.
There will be a small reference at the bottom of the page.

"Sell all" button will still sell all equipment on the page, and the script does not interact with it in any way

When a filter is active, you can switch it between filtering all equipment or only equipment in your inventory. Latter works faster.

Here are some filters:

q3- c1H2H tier12 eNone: leaves only fine and below one-handed and two-handed weapons of tiers 1 and 2 without prefix.
q2- eNone -sFocus: leaves only crude, fair and average equipment that does not have "of Focus" suffix.
-eNone cShieldClothLightHeavy: shows only armour with prefixes.

This post has been edited by Kelenius: Mar 2 2013, 14:15
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Mar 7 2013, 15:44
Post #575
Lement



Lalalala la~ la la~!
********
Group: Members
Posts: 2,977
Joined: 28-February 12
Level 326 (Godslayer)


Created recently MonsterBar Script for Zip. His has (bigger) magnet and imperil though, but what it does is one-click imperil/slow/weaken mobs with buttons next to them at the moment.

Attached File  Monsterbar.crx.zip ( 3.71k ) Number of downloads: 69
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Mar 9 2013, 03:30
Post #576
ChosenUno



A Legendary Collector
********
Group: Gold Star Club
Posts: 4,170
Joined: 23-February 10
Level 422 (Godslayer)


[github.com] https://github.com/trandoanhung1991/Low-Mana-Alert

Plays a sound when your MP is low.

Only for chrome.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Mar 9 2013, 12:21
Post #577
ChosenUno



A Legendary Collector
********
Group: Gold Star Club
Posts: 4,170
Joined: 23-February 10
Level 422 (Godslayer)


Yay, I'm nice so more freebies for you guys.

[github.com] Multi-Shriner
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Mar 12 2013, 15:17
Post #578
Lement



Lalalala la~ la la~!
********
Group: Members
Posts: 2,977
Joined: 28-February 12
Level 326 (Godslayer)


Wrote css that displays remaining pot number & type when in battle between battle mode and character since I'm always forgetting them. Does nothing for non-potions, and doesn't display non-godly potions in menu(because cba them).
Also, this doesn't work in fox(to do this in fox one would need to use embedded images in css).

[i49.tinypic.com] Screenshot due MNP.
Link:Attached File  Csstester.crx.zip ( 1.65k ) Number of downloads: 105


And code:
QUOTE
#togpane_item[style="display:none"] {
display: block !important;
height:0 !important;
}


#ikey_1[onmouseover*="Potion"]:after,#ikey_2[onmouseover*="Potion"]:after,#ikey_3[onmouseover*="Potion"]:after,#ikey_4[onmouseover*="Potion"]:after,#ikey_5[onmouseover*="Potion"]:after,#ikey_6[onmouseover*="Potion"]:after,#ikey_7[onmouseover*="Potion"]:after,#ikey_8[onmouseover*="Potion"]:after,#ikey_9[onmouseover*="Potion"]:after,#ikey_10[onmouseover*="Potion"]:after,#ikey_11[onmouseover*="Potion"]:after,#ikey_12[onmouseover*="Potion"]:after,#ikey_13[onmouseover*="Potion"]:after{
position:fixed;
height:12px;
top: 10px;
border-width: 1px;
border-style: solid;
pointer-events:none;
}
#ikey_1[onmouseover*="Potion"]:after{content:"1";left: 396px;}
#ikey_2[onmouseover*="Potion"]:after{content:"2";left: 408px;}
#ikey_3[onmouseover*="Potion"]:after{content:"3";left: 420px;}
#ikey_4[onmouseover*="Potion"]:after{content:"4";left: 432px;}
#ikey_5[onmouseover*="Potion"]:after{content:"5";left: 444px;}
#ikey_6[onmouseover*="Potion"]:after{content:"6";left: 456px;}
#ikey_7[onmouseover*="Potion"]:after{content:"7";left: 468px;}
#ikey_8[onmouseover*="Potion"]:after{content:"8";left: 480px;}
#ikey_9[onmouseover*="Potion"]:after{content:"9";left: 492px;}
#ikey_10[onmouseover*="Potion"]:after{content:"10";left: 503px;}
#ikey_11[onmouseover*="Potion"]:after{content:"11";left: 520px;}
#ikey_12[onmouseover*="Potion"]:after{content:"12";left: 537px;}
#ikey_13[onmouseover*="Potion"]:after{content:"13"; left: 554px;}

#ikey_1[onmouseover*="Potion"],#ikey_2[onmouseover*="Potion"],#ikey_3[onmouseover*="Potion"],#ikey_4[onmouseover*="Potion"],#ikey_5[onmouseover*="Potion"],#ikey_6[onmouseover*="Potion"],#ikey_7[onmouseover*="Potion"],#ikey_8[onmouseover*="Potion"],#ikey_9[onmouseover*="Potion"],#ikey_10[onmouseover*="Potion"],#ikey_11[onmouseover*="Potion"],#ikey_12[onmouseover*="Potion"],#ikey_13{
content:"";
height:0;
width:0;
}
#ikey_1[onmouseover*="Spirit Potion"]:after,#ikey_2[onmouseover*="Spirit Potion"]:after,#ikey_3[onmouseover*="Spirit Potion"]:after,#ikey_4[onmouseover*="Spirit Potion"]:after,#ikey_5[onmouseover*="Spirit Potion"]:after,#ikey_6[onmouseover*="Spirit Potion"]:after,#ikey_7[onmouseover*="Spirit Potion"]:after,#ikey_8[onmouseover*="Spirit Potion"]:after,#ikey_9[onmouseover*="Spirit Potion"]:after,#ikey_10[onmouseover*="Spirit Potion"]:after,#ikey_11[onmouseover*="Spirit Potion"]:after,#ikey_12[onmouseover*="Spirit Potion"]:after,#ikey_13[onmouseover*="Spirit Potion"]:after{
color: #FFDDDD;
border-color: #883300;
background: #DD6600;
}

#ikey_1[onmouseover*="Mana Potion"]:after,#ikey_2[onmouseover*="Mana Potion"]:after,#ikey_3[onmouseover*="Mana Potion"]:after,#ikey_4[onmouseover*="Mana Potion"]:after,#ikey_5[onmouseover*="Mana Potion"]:after,#ikey_6[onmouseover*="Mana Potion"]:after,#ikey_7[onmouseover*="Mana Potion"]:after,#ikey_8[onmouseover*="Mana Potion"]:after,#ikey_9[onmouseover*="Mana Potion"]:after,#ikey_10[onmouseover*="Mana Potion"]:after,#ikey_11[onmouseover*="Mana Potion"]:after,#ikey_12[onmouseover*="Mana Potion"]:after,#ikey_13[onmouseover*="Mana Potion"]:after{color: #FFFF00;
border-color:#000099;
background: #6699FF;
}
#ikey_1[onmouseover*="Health Potion"]:after,#ikey_2[onmouseover*="Health Potion"]:after,#ikey_3[onmouseover*="Health Potion"]:after,#ikey_4[onmouseover*="Health Potion"]:after,#ikey_5[onmouseover*="Health Potion"]:after,#ikey_6[onmouseover*="Health Potion"]:after,#ikey_7[onmouseover*="Health Potion"]:after,#ikey_8[onmouseover*="Health Potion"]:after,#ikey_9[onmouseover*="Health Potion"]:after,#ikey_10[onmouseover*="Health Potion"]:after,#ikey_11[onmouseover*="Health Potion"]:after,#ikey_12[onmouseover*="Health Potion"]:after,#ikey_13[onmouseover*="Health Potion"]:after{
color: #DDFFDD;
border-color: #009900;
background: #33BB33;
}
#ikey_1[onmouseover*="Godly Spirit Potion"]:before,#ikey_2[onmouseover*="Godly Spirit Potion"]:before,#ikey_3[onmouseover*="Godly Spirit Potion"]:before,#ikey_4[onmouseover*="Godly Spirit Potion"]:before,#ikey_5[onmouseover*="Godly Spirit Potion"]:before,#ikey_6[onmouseover*="Godly Spirit Potion"]:before,#ikey_7[onmouseover*="Godly Spirit Potion"]:before,#ikey_8[onmouseover*="Godly Spirit Potion"]:before,#ikey_9[onmouseover*="Godly Spirit Potion"]:before,#ikey_10[onmouseover*="Godly Spirit Potion"]:before,#ikey_11[onmouseover*="Godly Spirit Potion"]:before,#ikey_12[onmouseover*="Godly Spirit Potion"]:before,#ikey_13[onmouseover*="Godly Spirit Potion"]:before{content: url("http://ehgt.org/v/items/11316.png") no-repeat;}

#ikey_1[onmouseover*="Godly Mana Potion"]:before,#ikey_2[onmouseover*="Godly Mana Potion"]:before,#ikey_3[onmouseover*="Godly Mana Potion"]:before,#ikey_4[onmouseover*="Godly Mana Potion"]:before,#ikey_5[onmouseover*="Godly Mana Potion"]:before,#ikey_6[onmouseover*="Godly Mana Potion"]:before,#ikey_7[onmouseover*="Godly Mana Potion"]:before,#ikey_8[onmouseover*="Godly Mana Potion"]:before,#ikey_9[onmouseover*="Godly Mana Potion"]:before,#ikey_10[onmouseover*="Godly Mana Potion"]:before,#ikey_11[onmouseover*="Godly Mana Potion"]:before,#ikey_12[onmouseover*="Godly Mana Potion"]:before,#ikey_13[onmouseover*="Godly Mana Potion"]:before{content: url("http://ehgt.org/v/items/11216.png") no-repeat;}


#ikey_1[onmouseover*="Godly Health Potion"]:before,#ikey_2[onmouseover*="Godly Health Potion"]:before,#ikey_3[onmouseover*="Godly Health Potion"]:before,#ikey_4[onmouseover*="Godly Health Potion"]:before,#ikey_5[onmouseover*="Godly Health Potion"]:before,#ikey_6[onmouseover*="Godly Health Potion"]:before,#ikey_7[onmouseover*="Godly Health Potion"]:before,#ikey_8[onmouseover*="Godly Health Potion"]:before,#ikey_9[onmouseover*="Godly Health Potion"]:before,#ikey_10[onmouseover*="Godly Health Potion"]:before,#ikey_11[onmouseover*="Godly Health Potion"]:before,#ikey_12[onmouseover*="Godly Health Potion"]:before,#ikey_13[onmouseover*="Godly Health Potion"]:before{content: url("http://ehgt.org/v/items/11116.png") no-repeat;}


This post has been edited by Lement: Mar 12 2013, 15:29
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Mar 26 2013, 09:35
Post #579
eqwer



Vanilla Fan
*******
Group: Members
Posts: 2,467
Joined: 19-June 11
Level 319 (Godslayer)


QUOTE(Lement @ Mar 12 2013, 15:17) *

Wrote css that displays remaining pot number & type when in battle between battle mode and character since I'm always forgetting them. Does nothing for non-potions, and doesn't display non-godly potions in menu(because cba them).
Also, this doesn't work in fox(to do this in fox one would need to use embedded images in css).

[i49.tinypic.com] Screenshot due MNP.
Link:Attached File  Csstester.crx.zip ( 1.65k ) Number of downloads: 105


And code:

hope someone will write a firefox version
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Mar 26 2013, 18:02
Post #580
Lement



Lalalala la~ la la~!
********
Group: Members
Posts: 2,977
Joined: 28-February 12
Level 326 (Godslayer)


Img:after only works properly in opera iirc, doesn't work in chrome or fox. Luckily there's a bug in chrome that makes it work.

To run it in stylish in fox one would need to create an image sheet of 1-13 in 3 colors, set that as background with padding on image being the width and height of new pot images, use the image sheet as background with appropriate positioning. Or alternatively create 39 images for pots, and replace them individually, through this method would consume more RAM to cache the images. For examples look at ctxl's monster letters to numbers style.

However, you can't have your pot icons on the top and remaining in pot menu too. Well, unless there's some css3 selector that accepts images.

And as you can guess, cba to paint the numbers.

This post has been edited by Lement: Mar 26 2013, 18:02
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Mar 31 2013, 19:31
Post #581
sylprate



Newcomer
*
Group: Members
Posts: 30
Joined: 11-March 13
Level 243 (Godslayer)


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.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Mar 31 2013, 19:36
Post #582
Lement



Lalalala la~ la la~!
********
Group: Members
Posts: 2,977
Joined: 28-February 12
Level 326 (Godslayer)


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
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Mar 31 2013, 19:49
Post #583
sylprate



Newcomer
*
Group: Members
Posts: 30
Joined: 11-March 13
Level 243 (Godslayer)


ChosenUno? what is that?

Check my pages? I can't get it.

My problem is just nothing happen when I press s key, now.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Apr 1 2013, 01:34
Post #584
Lement



Lalalala la~ la la~!
********
Group: Members
Posts: 2,977
Joined: 28-February 12
Level 326 (Godslayer)


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
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Apr 1 2013, 04:25
Post #585
sylprate



Newcomer
*
Group: Members
Posts: 30
Joined: 11-March 13
Level 243 (Godslayer)


I already check my pages. Is there more action than show my equip?

still not working.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Apr 1 2013, 05:11
Post #586
Lement



Lalalala la~ la la~!
********
Group: Members
Posts: 2,977
Joined: 28-February 12
Level 326 (Godslayer)


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);
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Apr 1 2013, 05:39
Post #587
sylprate



Newcomer
*
Group: Members
Posts: 30
Joined: 11-March 13
Level 243 (Godslayer)


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.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post


291 Pages V « < 28 29 30 31 > » 
Reply to this topicStart new topic
2 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
1 Members: soileopes

 


Lo-Fi Version Time is now: 27th April 2025 - 01:20