Spell conversion script for 2e

== Regal Goblins ==
Extracting Spells from Regal Goblins spellist in case of major changes.
Last update: 04.09.2020.
		var allSpells=;
		function rgbToHex(rgb) {
 		rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
 		function hex(x) {
 		return ("0" + parseInt(x).toString(16)).slice(-2);
 		}
 		return "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
		}
		$('.card').each(function(){
			var spellColor = $(this).find('header').css('backgroundColor');
			spellColor = rgbToHex(spellColor).toUpperCase();
			spellColor = (spellColor == '#666666') ? '#999999' : spellColor;
			spellColor = (spellColor == '#0000C2') ? '#9999C2' : spellColor;
			var spellName = $(this).find('.name').html();
			var templateString = '{{Spell|'+spellName+' 2e|'+spellName+'|'+spellColor+'}}\n';
			allSpells += templateString;
 		});
		console.log(allSpells);
== Wiki ==
 $().each(function(){ //Whatever the holder element is
 var linkName = $(this).html().substring(0, linkName.indexOf('|','8')).replace('{{Spell|',);
 var pureName = linkName.replace(' (Priest) 2e', ).replace(' (Wizard) 2e', ).replace(' 2e', );
 var spellColor = $('b:contains('+pureName+')').closest('tr').css('background-color');
 if ( spellColor !== undefined) { 
 if ( !spellColor.match("^rgba") ) { 
 spellColor = rgbToHex(spellColor).toUpperCase(); } else { spellColor= '#CCCCCC';} //In case the color is broken
 spellColor = (spellColor == '#666666') ? '#999999' : spellColor;
	 spellColor = (spellColor == '#0000C2') ? '#9999C2' : spellColor; 
 var templateString = '{{Spell|'+linkName+'|'+linkName.replace(' 2e', )+'|'+spellColor+'}}\n'; 
 allSpells += templateString; 
 } else {alert(linkName);} 
 	 });
Category:Temporary Page
Category:Code for the Wiki