User:Nefastu/Coeff

From Guild Wars 2 Wiki
Jump to navigationJump to search

Calculation[edit]

  • coefficient = tooltip damage * 2597 / power / weapon strength
  • wiki damage = weapon strength * power * coeff / 2597
Weapon type Tooltip weapon strength Wiki weapon strength
Min Max Avg Min Max Avg
One-handed
Axe 621 759 690 857 1048 952.5
Dagger 669 711 690 924 981 952.5
Mace 649 731 690 895 1010 952.5
Pistol 635 745 690 876 1029 952.5
Scepter 649 731 690 895 1010 952.5
Sword 656 725 690.5 905 1000 952.5
Offhand only
Focus 603 640 621.5 832 883 857.5
Shield 584 658 621 806 909 857.5
Torch 571 671 621 789 926 857.5
Warhorn 590 652 621 814 900 857
Two-handed
Greatsword 721 797 759 995 1100 1047.5
Hammer 714 805 759.5 985 1111 1048.0
Longbow 667 783 725 920 1080 1000
Rifle 714 873 793.5 986 1205 1095.5
Short bow 656 725 690.5 905 1000 952.5
Staff 714 805 759.5 985 1111 1048.0
Aquatic
Aquatic 656 725 690.5 905 1000 952.5
Bundles, Transforms
Banners 690.5? 690.5?
Kits 690.5? 690.5?
Transforms 690.5? 690.5?

Tool[edit]

Save the content below as a .html on your computer and open it with your browser.

<html>
<head>
	<title>GW2W Skill Coefficient Utility</title>
	<script>
		//weapon strengths by weapon type, [level 77 fine, level 78 exotic, level 80 exotic, level 80 ascended]
		var strength = {
			//one-handed
			'Axe': 			[690.0,  922.5,  952.5, 1000],
			'Dagger':		[690.0,  922.5,  952.5, 1000],
			'Mace':			[690.0,  922.5,  952.5, 1000],
			'Pistol':		[690.0,  922.5,  952.5, 1000],
			'Scepter':		[690.0,  922.5,  952.5, 1000],
			'Sword':		[690.5,  922.5,  952.5, 1000],
			//off-hand only
			'Focus':		[621.5,  830.0,  857.5,  900], 
			'Shield':		[621.0,  830.5,  857.5,  900], 
			'Torch':		[621.0,  830.5,  857.5,  900], 
			'Warhorn':		[621.0,  830.5,  857.0,  900], 
			//two-handed
			'Greatsword':	[759.0, 1014.5, 1047.5, 1100],
			'Hammer':		[759.5, 1015.0, 1048.0, 1100],
			'Longbow':		[725.0,  968.5, 1000.0, 1050],
			'Rifle':		[793.5, 1061.0, 1095.5, 1150],
			'Short bow':	[690.5,  922.5,  952.5, 1000],
			'Staff':		[759.5, 1015.0, 1048.0, 1100],
			//aquatic
			'Aquatic':		[690.5,  922.5,  952.5, 1000],
			//utility skills/skills without a set weapon
			'Utility':		[690.5,  690.5,  690.5,  690.5], 
			'Bundle':		[690.5,  922.5,  922.5,  922.5], 
			'Transform':	[690.5,  772.5,  772.5,  772.5]  
		};
		//init values
		var damage = 0;
		var power = 1000;
		var hits = 1;
		var weapon = "Sword";
		var rarity = 2; //defaults to level 80 exotic
		var rarity_s = 0; //defaults to tooltip value (level 77 fine)
		var coeff = 0;
		var coeff_singlehit = 0;
		var calcdamage = 0;
		var round_coeff = 5;
		var round_calcdamage = 2;
		
		function update_coeff(){
			if (damage == 0 || power == 0) return;
			coeff = round(damage * 2597 / power / strength[weapon][rarity_s], round_coeff);
			
			if(hits>1){
				coeff_singlehit = round(damage / hits * 2597 / power / strength[weapon][rarity_s], round_coeff);
				document.getElementById('single-coeff').value = coeff_singlehit;
			}
			document.getElementById('coeff').value = coeff;
			update_dmg();
		}
		
		function update_dmg(){ 
			if(hits > 1){
				calcdamage = hits * round(strength[weapon][rarity] * 1000 * coeff_singlehit / 2597, round_calcdamage);
			}else{
				calcdamage = round(strength[weapon][rarity] * 1000 * coeff / 2597, round_calcdamage);
			}
			
			document.getElementById('calc-dmg').value = calcdamage;
			update_skillfact();
		}
		
		function update_skillfact(){
			var tmp = "";
			if(hits > 1){
				var tmp = "|strikes=" + hits;
			}
			var skillfact = "{{skill fact|damage|" + calcdamage + "|coefficient=" + coeff + tmp + "}}";
			document.getElementById('skillfact').value = skillfact;	
		}
		
		function hide_show_single_damage_coeff(){
			if(hits>1){
				document.getElementById('div-single-coeff').style.display = 'block';
			}else{
				document.getElementById('div-single-coeff').style.display = 'none';
			}
		}
		
		function c1(input){ power = input; update_coeff();} //required field: power
		function c2(input){ damage = input; update_coeff();} //required field: damage
		function c3(input){ //optional field: number of hits
			if(input > 0){
				hits = input;
			}else{
				hits = 1;
			}
			update_coeff();
			hide_show_single_damage_coeff();
		}			
		function c4(input){ weapon = input; update_coeff();} //required radio button selection: weapon type
		function c5(input){ rarity = input; update_dmg();} //required radio button selection: weapon rarity
		function c6(input){ coeff = input; update_dmg();} //optional field: calculated coefficient modification
		function c7(input){ calcdamage = input; update_skillfact();} //optional field: calculated damage modification
		function c8(input){ round_coeff = input; update_coeff();} //optional field: number of decimal places for calculated coefficient
		function c9(input){ round_calcdamage = input; update_dmg();} //optional field: number of decimal places for calculated damage
		function cA(input){ coeff_singlehit = input; update_dmg();} //optional field: calculated single hit coefficient modification
		function cB(input){ rarity_s = input; update_coeff();} //optional field: damage fact weapon strength
		function round(number, x){
			return Math.round(number*Math.pow(10, x))/Math.pow(10, x);
		}
		
		function toggle_strength_table(input){
			if(input == "show"){
				var table = "<button onclick='toggle_strength_table(\"hide\");'>Hide weapon strength table</button><br/>" +
						"<table><thead><tr>" +
						"<th>Weapon type</th>" +
						"<th style=\"color:#62A4DA;\">77 Fine</th>" +
						"<th style=\"color:#ffa405;\">78 Exotic (PvP)</th>" +
						"<th style=\"color:#ffa405;\">80 Exotic</th>" +
						"<th style=\"color:#fb3e8d;\">80 Ascended</th></tr>" +
						"</thead><tbody>";
				for (var key in strength){
					table += "<tr><th>" + key + "</th>";
					for (var i = 0; i < strength[key].length; i++){
						table += "<th>" + strength[key][i] + "</th>";
					}
					table += "</tr>";
				}
				table += "</tbody></table>";
				document.getElementById('strength-table').innerHTML = table;
			}
			if(input == "hide"){
				document.getElementById('strength-table').innerHTML = "<button onclick='toggle_strength_table(\"show\");'>Show weapon strength table</button>";
			}
		}
		
		function toggle_info(){
			if (document.getElementById("info").style.display == "block"){
				document.getElementById("info").style.display = "none";
			}else{
				document.getElementById("info").style.display = "block";
			}
		}
	</script>
	<style>
		table {
			border-collapse: collapse;
		}
	
		td, th {
			border: 1px solid #dddddd;
			text-align: left;
			padding: 8px;
		}

		tr:nth-child(even) {
			background-color: #dddddd;
		}
		
		input {
			margin: 5px;
		}
		
		input[type="number"]{
			width:40px;
		}
	</style>
		
</head>
<body>
	<div id="strength-table" style="float:right;align-right;"><button onclick='toggle_strength_table("show");'>Show weapon strength table</button></div>
	<h2>Skill coefficient utility for the Guild Wars 2 Wiki <button onclick="toggle_info();">Show/Hide info</button></h2>
	<div id="info" style="display:block;"><p>
	<b>Ensure no modifiers from traits that alter damage are active.</b><br/>
	Transform weapon strengths are based on two tests: 
		<a href="https://wiki.guildwars2.com/index.php?title=User:Nefastu/Sandbox3&oldid=1288229">test #1</a>, 
		<a href="https://wiki.guildwars2.com/index.php?title=User:Nefastu/Sandbox3&oldid=1292189">test #2</a><br/>
	<i>Used equations:<br/>
	Skill coefficient = Tooltip damage * 2597 / Power / Weapon strength<br/>
	Damage done = Weapon strength * Power * Skill coefficient / 2597</i><br/>
	</p></div>
	<h3>Required fields</h3>
	What are you looking at? <label><input type="radio" name="rarity_s" onclick="cB(0);" checked> Chat link I posted for myself</label><br/>
	My own skill bar: <label><input type="radio" name="rarity_s" onclick="cB(2);"> With an exotic weapon, </label>
	<label><input type="radio" name="rarity_s" onclick="cB(3);"> with an ascended weapon, </label>
	<label><input type="radio" name="rarity_s" onclick="cB(1);"> standing in Heart of the Mists</label><br/>
	<input type="text" id="power" placeholder="Power" value="1000" onkeyup="c1(this.value);"></input> Your power<br/>
	<input type="text" id="damage" placeholder="Damage" onkeyup="c2(this.value);"></input> Damage value from tooltip<br/>
	<input type="text" id="hits" placeholder="Number of hits" onkeyup="c3(this.value);"></input> Number of hits (putting a value greater than 1 will calcute the damage based on a single hit)<br/>
	<table>
		<thead>
			<tr><th>One-handed</th><th>Off-hand only</th><th>Two-handed</th><th>Utility/Other</th></tr>
		</thead>
		<tbody>
			<tr>
				<th><label><input type="radio" name="weapon" onclick="c4('Axe');"> Axe</label></th>
				<th><label><input type="radio" name="weapon" onclick="c4('Focus');"> Focus</label></th>
				<th><label><input type="radio" name="weapon" onclick="c4('Greatsword');"> Greatsword</label></th>
				<th><label><input type="radio" name="weapon" onclick="c4('Aquatic');"> Aquatic</label></th>
			</tr>
			<tr>
				<th><label><input type="radio" name="weapon" onclick="c4('Dagger');"> Dagger</label></th>
				<th><label><input type="radio" name="weapon" onclick="c4('Shield');"> Shield</label></th>
				<th><label><input type="radio" name="weapon" onclick="c4('Hammer');"> Hammer</label></th>
				<th><label><input type="radio" name="weapon" onclick="c4('Utility');"> Utility</label></th>
			</tr>
			<tr>
				<th><label><input type="radio" name="weapon" onclick="c4('Mace');"> Mace</label></th>
				<th><label><input type="radio" name="weapon" onclick="c4('Torch');"> Torch</label></th>
				<th><label><input type="radio" name="weapon" onclick="c4('Longbow');"> Longbow</label></th>
				<th><label><input type="radio" name="weapon" onclick="c4('Bundle');"> Bundle</label></th>
			</tr>
			<tr>
				<th><label><input type="radio" name="weapon" onclick="c4('Pistol');"> Pistol</label></th>
				<th><label><input type="radio" name="weapon" onclick="c4('Warhorn');"> Warhorn</label></th>
				<th><label><input type="radio" name="weapon" onclick="c4('Rifle');"> Rifle</label></th>
				<th><label><input type="radio" name="weapon" onclick="c4('Transform');"> Transform</label></th>
			</tr>
			<tr>
				<th><label><input type="radio" name="weapon" onclick="c4('Scepter');"> Scepter</label></th><th></th>
				<th><label><input type="radio" name="weapon" onclick="c4('Short bow');"> Short bow</label></th><th></th>
			</tr>
			<tr>
				<th><label><input type="radio" name="weapon" onclick="c4('Sword');" checked> Sword</label></th><th></th>
				<th><label><input type="radio" name="weapon" onclick="c4('Staff');"> Staff</label></th><th></th>
			</tr>
		</tbody>
	</table><br/>
	<b>Weapon level:
		<label style="color:#62A4DA;"><input type="radio" name="quality" onclick="c5(0);"> Level 77 Fine ('Unequipped')</label>
		<label style="color:#ffa405;"><input type="radio" name="quality" onclick="c5(1);"> Level 78 Exotic</label>
		<label style="color:#ffa405;"><input type="radio" name="quality" onclick="c5(2);" checked> Level 80 Exotic</label>
		<label style="color:#fb3e8d;"><input type="radio" name="quality" onclick="c5(3);"> Level 80 Ascended</label></b>
	<h3>Calculated coefficient and damage</h3>
	Coefficient <br/>
	<input type="text" id="coeff" onkeyup="c6(this.value);" placeholder="Coefficient"></input> rounded to
		<input type="number" onkeyup="c8(this.value);" onchange="c8(this.value);" value="5" min="0" max="10"></input> decimal places<br/>
	<div id="div-single-coeff" style="display:none;"><input type="text" id="single-coeff" onkeyup="cA(this.value);"></input> single damage coefficient<br/></div>
	Calculated damage<br/>
	<input type="text" id="calc-dmg" onkeyup="c7(this.value);" placeholder="Calculated damage"></input> rounded to
		<input type="number" onkeyup="c9(this.value);" onchange="c9(this.value);" value="2" min="0" max="10"></input> decimal places
	<h3>Damage skill fact</h3>
	<input type="text" id="skillfact" size="50" placeholder="{{skill fact|..."></input> <br/>
</body>
</html>