It is currently Thu Mar 28, 2024 7:43 pm

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post Post subject: The Haste Calculator
 
Offline
Godlike Poster
Godlike Poster
Years of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membership
User avatar

Joined: Sun Oct 16, 2005 9:42 am
Posts: 8798
Karma: 17

Location: Imagine in your mind a posh country club
Steam Login Name: azcn2503
2 versions...

Code:
<!DOCTYPE html PUBLIC "-/W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
      <title>Haste Calculator</title>
      <meta http-equiv="content-type" content="text/html;charset=iso-8859-1" />
      <script type="text/javascript"><!--
         function grab(o){
            return document.all?document.all[o]:document.getElementById?document.getElementById(o):"";
         }
         function recalc(){
            var w1d=grab("weapon1_delay").value; var w2d=grab("weapon2_delay").value; var h=grab("haste").value;
            grab("weapon2_delay").disabled=grab("weapon2_inuse").checked?"":"disabled";
            if(!isNaN(w1d)&&!isNaN(w2d)&&!isNaN(h)){
               var w1dh=w1d-(w1d*((h*.01)/2));
               var w2dh=w2d-(w2d*((h*.01)/2));
               if(grab("weapon2_inuse").checked){
                  w1dh*=1.3; w2dh*=1.3;
               }
               else{
                  w2dh=0;
               }
               var hpm=(60/w1dh)+(w2dh==0?0:(60/w2dh));
               // GRAPHING BELOW
               if(w1dh==w2dh){ lwd=w1d>w1dh?w1d:w1dh; }
               else{
                  if(w1d>w1dh||w2d>w2dh){ lwd=w1d>w2d?w1d:w2d; }
                  else{ lwd=w1dh>w2dh?w1dh:w2dh; }
               }
               if(!grab("weapon2_inuse").checked){ lwd=w1d>w1dh?w1d:w1dh; }
               g_w1d=Math.round((100/lwd)*w1d);
               g_w1dh=Math.round((100/lwd)*w1dh);
               g_w2d=Math.round((100/lwd)*w2d);
               g_w2dh=Math.round((100/lwd)*w2dh);
               if(!grab("weapon2_inuse").checked){ g_w2d=g_w2dh=0; }
               grab("g_w1d").style.width=g_w1d+"%";
               grab("g_w1dh").style.width=g_w1dh+"%";
               grab("g_w2d").style.width=g_w2d+"%";
               grab("g_w2dh").style.width=g_w2dh+"%";
               // GRAPHING ABOVE
               grab("weapon1_delay_actual").innerHTML=Math.round(w1dh*10)/10+" sec";
               grab("weapon2_delay_actual").innerHTML=Math.round(w2dh*10)/10+" sec";
               grab("hitspermin").innerHTML=Math.round(hpm*10)/10+"/min";
            }
         }
      //--></script>
      <style type="text/css"><!--
         *{
            font-family:tahoma;
            font-size:12pt;
         }
         input{
            border:0;
            background-color:#ccc;
         }
         .result{
            font-size:12pt;
            font-weight:bold;
            color:#0c0;
         }
         table td{ padding:5px; }
         .bar1{ background-color:#c00; }
         .bar2{ background-color:#00c; }
         .bar1,.bar2{ height:15px; }
         .barbox{ background-color:#ccc; }
      //--></style>
   </head>
   <body onload="recalc();">
      <div align="center">
         <table style="width:600px;">
            <tr>
               <td>&nbsp;</td>
               <td>Weapon 1 Delay:</td>
               <td><input type="text" id="weapon1_delay" value="4" onkeydown="recalc();" onkeyup="recalc();" /></td>
            </tr>
            <tr>
               <td><input type="checkbox" id="weapon2_inuse" checked="checked" onclick="recalc();" /></td>
               <td>Weapon 2 Delay:</td>
               <td><input type="text" id="weapon2_delay" value="4" onkeydown="recalc();" onkeyup="recalc();" /></td>
            </tr>
            <tr>
               <td>&nbsp;</td>
               <td>Haste:</td>
               <td><input type="text" id="haste" value="35" onkeydown="recalc();" onkeyup="recalc();" /></td>
            </tr>
            <tr>
               <td>&nbsp;</td>
               <td>Actual Weapon 1 Delay:</td>
               <td><span id="weapon1_delay_actual" class="result">?</span></td>
            </tr>
            <tr>
               <td>&nbsp;</td>
               <td>Actual Weapon 2 Delay:</td>
               <td><span id="weapon2_delay_actual" class="result">?</span></td>
            </tr>
            <tr>
               <td>&nbsp;</td>
               <td>Hits/min:</td>
               <td><span id="hitspermin" class="result">?</span></td>
            </tr>
         </table>
         
         <table style="width:600px;">
            <tr>
               <td>Weapon 1 Delay:</td>
               <td style="width:60%" class="barbox"><div id="g_w1d" class="bar1"></div></td>
            </tr>
            <tr>
               <td>Actual Weapon 1 Delay:</td>
               <td class="barbox"><div id="g_w1dh" class="bar2"></div></td>
            </tr>
            <tr>
               <td>Weapon 2 Delay:</td>
               <td class="barbox"><div id="g_w2d" class="bar1"></div></td>
            </tr>
            <tr>
               <td>Actual Weapon 2 Delay:</td>
               <td class="barbox"><div id="g_w2dh" class="bar2"></div></td>
            </tr>
      </div>
   </body>
</html>


Or attached.


You do not have the required permissions to view the files attached to this post.

_________________
Follow your heart and live the dream <3


Thu Jun 17, 2010 9:33 am 
 Profile E-mail  
 
 Post Post subject: Re: The Haste Calculator
 
Offline
Eagle Eye (Mod)
Eagle Eye (Mod)
Years of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membership
User avatar

Joined: Fri Oct 14, 2005 7:15 am
Posts: 2128
Karma: 20

Location: On the Internet
Steam Login Name: kyhas
nice calculator

_________________
Image


Thu Jun 17, 2010 10:19 am 
 Profile E-mail  
 
 Post Post subject: Re: The Haste Calculator
 
Offline
Godlike Poster
Godlike Poster
Years of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membership
User avatar

Joined: Sun Oct 16, 2005 9:42 am
Posts: 8798
Karma: 17

Location: Imagine in your mind a posh country club
Steam Login Name: azcn2503
I would just like to say that I did something absolutely rediculous and I changed a few lines of code...

Code:
               /*if(w1dh==w2dh){ lwd=w1d>w1dh?w1d:w1dh; }
               else{
                  if(w1d>w1dh||w2d>w2dh){ lwd=w1d>w2d?w1d:w2d; }
                  else{ lwd=w1dh>w2dh?w1dh:w2dh; }
               }*/


Changed to...

Code:
lwd=w1dh==w2dh?w1d>w1dh?w1d:w1dh:w1d>w1dh||w2d>w2dh?w1d>w2d?w1d:w2d:w1dh>w2dh?w1dh:w2dh;


LOL

So yeah here's version 2:

Spoiler for Haste Calculator:
Code:
<!DOCTYPE html PUBLIC "-/W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
      <title>Haste Calculator</title>
      <meta http-equiv="content-type" content="text/html;charset=iso-8859-1" />
      <script type="text/javascript"><!--
         function grab(o){ return document.all?document.all[o]:document.getElementById?document.getElementById(o):""; }
         function recalc(){
            var w1d=grab("weapon1_delay").value; var w2d=grab("weapon2_delay").value; var h=grab("haste").value;
            var w2iu=grab("weapon2_inuse").checked;
            grab("weapon2_delay").disabled=grab("weapon2_inuse").checked?"":"disabled";
            if(!isNaN(w1d)&&!isNaN(w2d)&&!isNaN(h)){
               var w1dh=w1d-(w1d*((h*.01)/2));
               var w2dh=w2d-(w2d*((h*.01)/2));
               w1dh*=w2iu?1.3:1;
               w2dh*=w2iu?1.3:!w2iu?0:1;
               var hpm=(60/w1dh)+(w2dh==0?0:(60/w2dh));
               var lwd=w1dh==w2dh?w1d>w1dh?w1d:w1dh:w1d>w1dh||w2d>w2dh?w1d>w2d?w1d:w2d:w1dh>w2dh?w1dh:w2dh;
               lwd=!w2iu?w1d>w1dh?w1d:w1dh:lwd;
               g_w1d=Math.round((100/lwd)*w1d);
               g_w1dh=Math.round((100/lwd)*w1dh);
               g_w2d=w2iu?Math.round((100/lwd)*w2d):0;
               g_w2dh=w2iu?Math.round((100/lwd)*w2dh):0;
               grab("g_w1d").style.width=g_w1d+"%";
               grab("g_w1dh").style.width=g_w1dh+"%";
               grab("g_w2d").style.width=g_w2d+"%";
               grab("g_w2dh").style.width=g_w2dh+"%";
               grab("weapon1_delay_actual").innerHTML=Math.round(w1dh*10)/10+" sec";
               grab("weapon2_delay_actual").innerHTML=Math.round(w2dh*10)/10+" sec";
               grab("hitspermin").innerHTML=Math.round(hpm*10)/10+"/min";
            }
         }
      //--></script>
      <style type="text/css"><!--
         table tr{ padding:0; margin:0; }
         table td{ padding:0; margin:0; }
         .bar1{ background-color:#c00; }
         .bar2{ background-color:#00c; }
         .bar1,.bar2{ height:20px; }
         .barbox{ background-color:#ccc; }
      //--></style>
   </head>
   <body onload="recalc();">
      <div align="center">
         <table style="width:600px;">
            <tr>
               <td style="width:5%;">&nbsp;</td>
               <td style="width:35%;">Weapon 1 Delay:</td>
               <td style="width:60%;"><input type="text" id="weapon1_delay" value="4" onkeydown="recalc();" onkeyup="recalc();" /></td>
            </tr>
            <tr>
               <td><input type="checkbox" id="weapon2_inuse" checked="checked" onclick="recalc();" /></td>
               <td>Weapon 2 Delay:</td>
               <td><input type="text" id="weapon2_delay" value="4" onkeydown="recalc();" onkeyup="recalc();" /></td>
            </tr>
            <tr>
               <td>&nbsp;</td>
               <td>Haste %:</td>
               <td><input type="text" id="haste" value="35" onkeydown="recalc();" onkeyup="recalc();" /></td>
            </tr>
            <tr>
               <td>&nbsp;</td>
               <td>Actual Weapon 1 Delay:</td>
               <td><span id="weapon1_delay_actual" class="result">?</span></td>
            </tr>
            <tr>
               <td>&nbsp;</td>
               <td>Actual Weapon 2 Delay:</td>
               <td><span id="weapon2_delay_actual" class="result">?</span></td>
            </tr>
            <tr>
               <td>&nbsp;</td>
               <td>Hits/min:</td>
               <td><span id="hitspermin" class="result">?</span></td>
            </tr>
         </table>
         

         <table style="width:600px;">
            <tr>
               <td style="width:40%;">Weapon 1 Delay:</td>
               <td style="width:60%" class="barbox"><div id="g_w1d" class="bar1"></div></td>
            </tr>
            <tr>
               <td>Actual Weapon 1 Delay:</td>
               <td class="barbox"><div id="g_w1dh" class="bar2"></div></td>
            </tr>
            <tr>
               <td>Weapon 2 Delay:</td>
               <td class="barbox"><div id="g_w2d" class="bar1"></div></td>
            </tr>
            <tr>
               <td>Actual Weapon 2 Delay:</td>
               <td class="barbox"><div id="g_w2dh" class="bar2"></div></td>
            </tr>
         </table>
      </div>
   </body>
</html>

_________________
Follow your heart and live the dream <3


Fri Jun 18, 2010 10:00 am 
 Profile E-mail  
 
 Post Post subject: Re: The Haste Calculator
 
Offline
Godlike Poster
Godlike Poster
Years of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membership
User avatar

Joined: Sun Oct 16, 2005 9:42 am
Posts: 8798
Karma: 17

Location: Imagine in your mind a posh country club
Steam Login Name: azcn2503
I have just been informed that the delay on dual-wield may be 1/3 (1.333... etc), so if that is true then just change *=w2iu?1.3 to *=w2iu?4/3 job done.

_________________
Follow your heart and live the dream <3


Fri Jun 18, 2010 4:13 pm 
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Karma functions powered by Karma MOD © 2007, 2009 m157y