Widget:HoMtest

HoMtest widget, code written by User:Kaede, User:M.mendel, and User:Dr_ishmael see Forum:Coding

The widget will display some HoM achievements, albeit in a bit technical format (see Forum:Coding), if you give it the string that the HoM calculator at hom.guildwars2.com adds to the URL after you enter a character name.

Usage example
Use "fel", "dev", "res", "val", "hon" for each monument. If left out, it just uses Devotion as the first monument. This widget is very much used for testing, expect the widget and its output to change until we have something final.  var homString = ""; var defaultMon = "";

if(decodeURIComponent(homString).search(/[A-Za-z0-9\+\-\/]{1,43}/i) == -1) {//This should ensure we only get 43 character strings with only base64 chars homString = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'; }

//complete base64 String var res = ""; //resilience string var fel = ""; //fellowship string var hon = ""; //honor string var val = ""; //valor string var dev = ""; //devotion string var score = new Array(0,0,0,0,0); var resC = 0; var honC = 0; var valC = 0; var felC = 0;

var resAr = new Array( "Elite Cantha Armor",  "Elite Exotic Armor",  "Elite Kurzick Armor",  "Elite Luxon Armor",  "Imperial Ascended Armor",  "Ancient Armor",  "Elite Sunspear Armor",  "Vabbian Armor",  "Primeval Armor",  "Asuran Armor",  "Norn Armor",  "Silver Eagle Armor",  "Monument Armor",  "Obsidian Armor",  "Granite Citadel Elite Armor",  "Granite Citadel Exclusive Armor",  "Granite Citadel Ascended Armor",  "Marhan's Grotto Elite Armor",  "Marhan's Grotto Exclusive Armor",  "Marhan's Grotto Ascended Armor" );

var felAr = new Array( "Zenmai",  "Norgu",  "Goren",  "Zhed Shadowhoof",  "General Morgahn",  "Margrid the Sly",  "Tahlkora",  "Razah",  "Master of Whispers",  "Koss",  "Dunkoro",  "Melonni",  "Acolyte Jin",  "Acolyte Sousuke",  "Vekk",  "Livia",  "Hayda",  "Ogden Stonehealer",  "Pyre Fierceshot",  "Jora",  "Kahmu",  "Xandra",  "Anton",  "Gwen",  "Animal Companion",  "Black Moa",  "Imperial Phoenix",  "Black Widow Spider",  "Olias",  "M.O.X." );

var honAr = new Array( "Eternal Champion",  "Eternal Commander",  "Eternal Skillz",  "Eternal Gladiator",  "Eternal Hero",  "Eternal Lightbringer",  "Eternal Bookah",  "Eternal Delver",  "Eternal Slayer",  "Eternal Ebon Vanguard Agent",  "Eternal Defender of Ascalon",  "Eternal Tyrian Cartographer",  "Eternal Guardian of Tyria",  "Eternal Protector of Tyria",  "Eternal Tyrian Skill Hunter",  "Eternal Tyrian Vanquisher",  "Eternal Canthan Cartographer",  "Eternal Guardian of Cantha",  "Eternal Protector of Cantha",  "Eternal Canthan Skill Hunter",  "Eternal Canthan Vanquisher",  "Eternal Savior of the Kurzicks",  "Eternal Savior of the Luxons",  "Eternal Elonian Cartographer",  "Eternal Guardian of Elona",  "Eternal Protector of Elona",  "Eternal Elonian Skill Hunter",  "Eternal Elonian Vanquisher",  "Eternal Ale-Hound",  "Eternal Party Animal",  "Eternal Master of the North",  "Eternal Legendary Cartographer", "Eternal Legendary Guardian", "Eternal Legendary Skill Hunter", "Eternal Legendary Vanquisher", "Eternal Fortune", "Eternal Sweet Tooth", "Eternal Spearmarshal", "Eternal Survivor", "(empty)", "Eternal Treasure Hunter", "Eternal Misfortune", "Eternal Source of Wisdom", "Eternal Hero of Tyria", "Eternal Hero of Cantha", "Eternal Hero of Elona", "Eternal Conqueror of Sorrow's Furnace", "Eternal Conqueror of the Deep", "Eternal Conqueror of Urgoz's Warren", "Eternal Conqueror of the Fissure of Woe", "Eternal Conqueror of the Underworld", "Eternal Conqueror of the Domain of Anguish", "Eternal Zaishen Supporter", "Eternal Codex Disciple" );

var valAr = new Array( "Destroyer Axe",  "Destroyer Bow",  "Destroyer Daggers",  "Destroyer Focus",  "Destroyer Maul",  "Destroyer Scepter",  "Destroyer Scythe",  "Destroyer Shield",  "Destroyer Spear",  "Destroyer Staff",  "Destroyer Sword",  "Tormented Axe",  "Tormented Bow",  "Tormented Daggers",  "Tormented Focus",  "Tormented Maul",  "Tormented Scepter",  "Tormented Scythe",  "Tormented Shield",  "Tormented Spear",  "Tormented Staff",  "Tormented Sword",  "Oppressor Axe",  "Oppressor Bow",  "Oppressor Daggers",  "Oppressor Focus",  "Oppressor Maul",  "Oppressor Scepter",  "Oppressor Scythe",  "Oppressor Shield",  "Oppressor Spear",  "Oppressor Staff",  "Oppressor Sword" );

var devAr = new Array (	"",//common	"",//uncommon	"",//rare	"" //unique )

function convDecBin ( dec ) { //converts one decimal number to a 6 bit binary var output = parseInt(dec).toString(2); while(output.length<6) { output = "0"+output; }	return output; }

function convBase64Dec ( base64 ) {//converts one letter to its decimal value var aNetBase = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; var output = aNetBase.indexOf(base64); return output; }

function convBase64Bin ( base64 ) { var output = ""; var i = 0; var k = ""; while ( i < base64.length ) { 						//run through base64 string k = base64.charAt(i); output += convDecBin(convBase64Dec(k)); i++; }	return output; }

function rotateString ( binary ) { var output = ""; var blocks = new Array; var i = 0; var k = 0; while ( k < binary.length ) {			           //complete rotation blocks[i] = binary.substr(k,6);					//split into 6 bit parts k = k + 6; for (var p = 5; p >= 0; p--){					//rotate each part output += blocks[i].toString.charAt(p);	//and merge them }		i++; }	return output; }

function splitString ( binary ) { res = binary.substr(0,32); fel = binary.substr(32,32); hon = binary.substr(64,64); val = binary.substr(128,64); dev = binary.substr(192,64); }

function calculateHoM ( string ) { return rotateString(convBase64Bin(decodeURIComponent(string))); }

function selectDev { var helper = ""; var number = 0; for (var i = 0; i <= 3; i++) { number = 0; helper = dev.substr(i*7,7); for (var p = 6; p >= 0; p--){ number += helper.charAt(p)*Math.pow(2,p); }		devAr[i] = number; } }

function selectRes { resAr2 = new Array(resAr.length); for (var i = 0; i < resAr.length; i++) { if(res.charAt(i) == 1){ resAr2[i] = 'in'; resC += 1; }		else resAr2[i] = 'out'; } }

function selectFel { felAr2 = new Array(felAr.length); for (var i = 0; i < felAr.length; i++) { if(fel.charAt(i) == 1){ felAr2[i] = 'in'; felC += 1; }		else felAr2[i] = 'out'; } }

function selectVal { valAr2 = new Array(valAr.length); for (var i = 0; i < valAr.length; i++) { if(val.charAt(i) == 1) { valAr2[i] = 'in'; valC += 1; }		else valAr2[i] = 'out'; } }

function selectHon { honAr2 = new Array(honAr.length); for (var i = 0; i < honAr.length; i++) { if(hon.charAt(i) == 1){ honAr2[i] = 'in'; honC += 1; }		else honAr2[i] = 'out'; } }

function selectMonuments{ selectDev; selectRes; selectFel; selectVal; selectHon; calculatePoints }

function calculatePoints{ //devotion var i = 0; if(devAr[0]+devAr[1]+devAr[2]+devAr[3]>0) i+=1;		//1	Any miniature if(devAr[2]>0) i+=1;								//1 Any rare (gold) miniature if(devAr[3]>0) i+=1;								//1 Any unique (green) miniature if(devAr[0]+devAr[1]+devAr[2]+devAr[3]>=20) i+=2;	//2 20 miniatures (full display) if(devAr[0]+devAr[1]+devAr[2]+devAr[3]>=30) i+=1;	//1 30 miniatures if(devAr[0]+devAr[1]+devAr[2]+devAr[3]>=40) i+=1;	//1 40 miniatures if(devAr[0]+devAr[1]+devAr[2]+devAr[3]>=50) i+=1;	//1 50 miniatures score[0] = i;	//resilience i = 0; if(resC > 0) i+=1;									//1 Any armor statue if(resC > 2) i+=1;									//1 3 armor statues if(resC > 4) i+=2;									//2 5 armor statues (full display) if(resC > 6) i+=1;									//1 7 armor statues if(resAr2[2] == 'in' || resAr2[3] == 'in') i+=1;	//1 Kurzick or Luxon armor statue if(resAr2[7] == 'in') i+=1;							//1 Vabbian armor statue if(resAr2[13] == 'in') i+=1;						//1 Obsidian armor statue score[1] = i;	//fellowship i = 0; var helper = 0; for(var k = 0; k<=29; k++) { if(k == 24 || k == 25 || k == 26 || k == 27) {} else { if(felAr2[k]=='in') helper = 1; }	}	if(helper == 1) i+=1; //1 Any hero statue if(felAr2[24] == 'in' || felAr2[25] == 'in' || felAr2[26] == 'in' || felAr2[27] == 'in') i+=1; //1 Any pet statue 25-28 if(felAr2[25] == 'in' || felAr2[26] == 'in' || felAr2[27] == 'in') i+=1; //1 Any rare pet statue 26-28 if(felC > 4) i+=2;//2 5 companion statues (full display) if(felC > 9) i+=1;//1 10 companion statues if(felC > 19) i+=1;//1 20 companion statues if(felC > 29) i+=1;//1 30 companion statues score[2] = i;	//honor i = 3; //3 accounts linked if(honC>=1) i+=2;//2 any statue if(	  honAr2[0] == 'in' || honAr2[1] == 'in' 		|| honAr2[3] == 'in' || honAr2[4] == 'in' 		|| honAr2[52] == 'in' || honAr2[53] == 'in' ) i+=3;//3 any pvp statue 0 1 3 4 52 53 if(honC>=5) i+=3;//3 5 statues if(honC%5 == 0) i+=honC/5-1;//1 for each 5 statues score[3] = i;	//valor i = 0; if(valC >= 1) i+=1; //1 Any weapon statue helper = 0;//1 Destroyer weapon statue for(var k = 0; k <= 10; k++) { if(valAr2[k]=='in') helper = 1; } if(helper == 1) i+=1; helper = 0;//1 Tormented weapon statue for(var k = 11; k <= 21; k++) { if(valAr2[k]=='in') helper = 1; } if(helper == 1) i+=1; helper = 0;//1 Oppressor weapon statue for(var k = 22; k <= 32; k++) { if(valAr2[k]=='in') helper = 1; } if(helper == 1) i+=1; if(valC >= 4) i+=1; //1 5 weapon statues if(valC >= 10) i+=2; //2 11 weapon statues (full display) if(valC >= 14) i+=1; //1 15 weapon statues score[4] = i; }

function tvc( id ) { if (document.getElementById) { var mydiv = document.getElementById(id); mydiv.style.display = (mydiv.style.display=='block'?'none':'block'); } }

function toggleMonuments( id ) { switch(id) { case 'hom_dev': document.getElementById('hom_dev').style.display = 'block'; document.getElementById('hom_fel').style.display = 'none'; document.getElementById('hom_val').style.display = 'none'; document.getElementById('hom_res').style.display = 'none'; document.getElementById('hom_hon').style.display = 'none'; document.getElementById('ares').setAttribute('class', ''); document.getElementById('adev').setAttribute('class', 'actual'); document.getElementById('afel').setAttribute('class', ''); document.getElementById('ahon').setAttribute('class', ''); document.getElementById('aval').setAttribute('class', ''); break; case 'hom_res': document.getElementById('hom_dev').style.display = 'none'; document.getElementById('hom_fel').style.display = 'none'; document.getElementById('hom_val').style.display = 'none'; document.getElementById('hom_res').style.display = 'block'; document.getElementById('hom_hon').style.display = 'none'; document.getElementById('ares').setAttribute('class', 'actual'); document.getElementById('adev').setAttribute('class', ''); document.getElementById('afel').setAttribute('class', ''); document.getElementById('ahon').setAttribute('class', ''); document.getElementById('aval').setAttribute('class', ''); break; case 'hom_fel': document.getElementById('hom_dev').style.display = 'none'; document.getElementById('hom_fel').style.display = 'block'; document.getElementById('hom_val').style.display = 'none'; document.getElementById('hom_res').style.display = 'none'; document.getElementById('hom_hon').style.display = 'none'; document.getElementById('ares').setAttribute('class', ''); document.getElementById('adev').setAttribute('class', ''); document.getElementById('afel').setAttribute('class', 'actual'); document.getElementById('ahon').setAttribute('class', ''); document.getElementById('aval').setAttribute('class', ''); break; case 'hom_val': document.getElementById('hom_dev').style.display = 'none'; document.getElementById('hom_fel').style.display = 'none'; document.getElementById('hom_val').style.display = 'block'; document.getElementById('hom_res').style.display = 'none'; document.getElementById('hom_hon').style.display = 'none'; document.getElementById('ares').setAttribute('class', ''); document.getElementById('adev').setAttribute('class', ''); document.getElementById('afel').setAttribute('class', ''); document.getElementById('ahon').setAttribute('class', ''); document.getElementById('aval').setAttribute('class', 'actual'); break; case 'hom_hon': document.getElementById('hom_dev').style.display = 'none'; document.getElementById('hom_fel').style.display = 'none'; document.getElementById('hom_val').style.display = 'none'; document.getElementById('hom_res').style.display = 'none'; document.getElementById('hom_hon').style.display = 'block'; document.getElementById('ares').setAttribute('class', ''); document.getElementById('adev').setAttribute('class', ''); document.getElementById('afel').setAttribute('class', ''); document.getElementById('ahon').setAttribute('class', 'actual'); document.getElementById('aval').setAttribute('class', ''); break; } }

function grayResOut { var help = ""; for( var i = 1; i <= 20; i++) { help = i.toString; if(resAr2[i-1]=='out') { document.getElementById("tdres"+help+"a").setAttribute('class', 'hom_out'); document.getElementById("tdres"+help+"b").setAttribute('class', 'hom_out'); }		else { document.getElementById("tdres"+help+"a").setAttribute('class', 'hom_in'); document.getElementById("tdres"+help+"b").setAttribute('class', 'hom_in'); }	} }

function grayValOut { var help = ""; for( var i = 1; i <= 33; i++) { help = i.toString; if(valAr2[i-1]=='out') { document.getElementById("tdval"+help+"a").setAttribute('class', 'hom_out'); document.getElementById("tdval"+help+"b").setAttribute('class', 'hom_out'); }		else { document.getElementById("tdval"+help+"a").setAttribute('class', 'hom_in'); document.getElementById("tdval"+help+"b").setAttribute('class', 'hom_in'); }	} }

function grayFelOut { var help = ""; for( var i = 1; i <= 30; i++) { help = i.toString; if(felAr2[i-1]=='out') { document.getElementById("tdfel"+help+"a").setAttribute('class', 'hom_out'); document.getElementById("tdfel"+help+"b").setAttribute('class', 'hom_out'); }		else { document.getElementById("tdfel"+help+"a").setAttribute('class', 'hom_in'); document.getElementById("tdfel"+help+"b").setAttribute('class', 'hom_in'); }	} }

splitString(calculateHoM( homString )); //call this to calculate all vars selectMonuments;					   //and call this to decide what you got and what you did not.

 /*<![CDATA[*/ table.hom { margin:auto; border-collapse:collapse; text-align:center; width:100%; } table.hom td, table.hom th { border:thin solid silver; padding: 4px; } div#hom_navigation { width: 100%; position:relative; bottom:-2px; background:white; } div#hom_navigation a { display: inline-block; margin: 0 1px 0 0; padding: 0.2em 1ex 0 1ex; height: 1.5em; text-align: center; font-size: 1.2em; border: thin solid silver; border-top-right-radius: 3px; border-top-left-radius: 3px; color: #002bb8; cursor: pointer; } div#hom_navigation a:active, div#hom_navigation a:hover, div#hom_navigation a:focus { border-bottom: white; } div#hom_navigation a.actual { font-weight: bold; background: white; border-bottom: white; } div#hom_box { border: thin solid silver; margin: -1px 0 4px 0; padding: 2px; } div.hom_div { display: none; } div.hom_div.default_mon { /*display: block;*/ } div.hom_div p.hom_desc { font-size: 0.75em; padding: 5px; margin: 0; width: 100%; text-align:center; } div.hom_progress { z-index: 0; margin: 2px auto; width: 600px; height: 20px; padding: 0; border: 1px solid black } div.hom_prog_text { z-index:2; height: 20px; width: 600px; position:absolute; text-align: center; padding: 0; margin: 0; color: whitesmoke; font-weight: bold; } div.hom_prog1 { z-index:1; float: left; margin: 0; height: 20px; padding: 0; background: limegreen; } div.hom_prog2 { z-index:1; float: right; margin: 0; height: 20px; padding: 0; background: orangered; } td.hom_out { background: whitesmoke; color: gray !important; font-style: italic !important; } td.hom_in { background: powderblue; } td.hom_out img { opacity: 0.5; -moz-opacity:0.5; -khtml-opacity: 50; filter: alpha(opacity=50); -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; border: none; } td.hom_out img:hover, td.hom_out a:hover img { opacity: 1; -moz-opacity: 1; -khtml-opacity: 100; filter: alpha(opacity=100); -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; } table.hom td[colspan="11"] { font-weight: bold; } /*]]>*/

My Hall of Monuments (document.write(""+(score[0]+score[1]+score[2]+score[3]+score[4])+"/50"); )  Devotion Resilience Fellowship Honor Valor</a> <div id="hom_box">

<div id="hom_dev" class="hom_div"> <div class="hom_progress"> <div class="hom_prog_text"><script type="text/javascript">document.write(score[0]); /8 Points</a> <script type="text/javascript">document.write("<div class='hom_prog1' style='width:"+Math.round((score[0]/8*100),0)+"%;'> <div class='hom_prog2' style='width:"+Math.floor((100-score[0]/8*100),0)+"%;'> "); <p class="hom_desc">Monument of Devotion</a>

<div id="hom_res" class="hom_div"> <div class="hom_progress"> <div class="hom_prog_text"><script type="text/javascript">document.write(score[1]); /8 Points</a> <script type="text/javascript">document.write("<div class='hom_prog1' style='width:"+Math.round((score[1]/8*100),0)+"%;'> <div class='hom_prog2' style='width:"+Math.floor((100-score[1]/8*100),0)+"%;'> "); <p class="hom_desc">Monument of Resilience</a>

<div id="hom_fel" class="hom_div"> <div class="hom_progress"> <div class="hom_prog_text"><script type="text/javascript">document.write(score[2]); /8 Points</a> <script type="text/javascript">document.write("<div class='hom_prog1' style='width:"+Math.round((score[2]/8*100),0)+"%;'> <div class='hom_prog2' style='width:"+Math.floor((100-score[2]/8*100),0)+"%;'> "); <p class="hom_desc">Monument of Fellowship</a>

<div id="hom_hon" class="hom_div"> <div class="hom_progress"> <div class="hom_prog_text"><script type="text/javascript">document.write(score[3]); /18 Points</a> <script type="text/javascript">document.write("<div class='hom_prog1' style='width:"+Math.round((score[3]/18*100),0)+"%;'> <div class='hom_prog2' style='width:"+Math.round((100-score[3]/18*100),0)+"%;'> "); <p style="font-style:italic">Will be added soon... <p class="hom_desc">Monument of Honor</a>

<div id="hom_val" class="hom_div"> <div class="hom_progress"> <div class="hom_prog_text"><script type="text/javascript">document.write(score[4]); /8 Points</a> <script type="text/javascript">document.write("<div class='hom_prog1' style='width:"+Math.round((score[4]/8*100),0)+"%;'> <div class='hom_prog2' style='width:"+Math.floor((100-score[4]/8*100),0)+"%;'> "); <p class="hom_desc">Monument of Valor</a>

<script type="text/javascript"> grayResOut; grayValOut; grayFelOut; grayHonOut; toggleMonuments("hom_"+defaultMon);