Loot Statistics/Code

//Based on: Updated on January 2, 2010 http://tibiacalc.vndv.com/loot.txt  var current_tibia_version = 8.54; document.getElementById('lootparser_loot').style.display = 'none'; document.getElementById('lootparser_add').style.display = 'none'; /* Code used for Loot_Statistics */ function hebi (id) { document.getElementById(id).style.display = 'none'; } function sebi (id) { document.getElementById(id).style.display = 'inline'; } function shebi (id, a, b) { var d = document.getElementById(id).style.display; document.getElementById(id).style.display = (d == 'none' ? 'inline' : 'none'); this.value = (d == 'none' ? b : a); } function gebi (id) { return document.getElementById(id); } function trim (str) { str = str.replace(/^\s\s*/, ''); var ws = /\s/, i = str.length; while (ws.test(str.charAt(--i))); return str.slice(0, i + 1); } function stripslashes (str) { return (str+).replace(/\\(.?)/g, function (s, n1) {   switch (n1) {      case '\\': return '\\';      //case '0': return '\u000';      case : return '';      default: return n1;    }  }); } function is_numeric (v) { v = parseFloat(v); return typeof(v) === 'number' && !isNaN(v); } function ucwords (str) { str = (str+'').replace(/^(.)|\s(.)/g, function ($1) { return $1.toUpperCase; }); return str.replace(' Of The ', ' of the '); } function array_sort(inputArr, numeric, by_value, reverse) { var tmp_arr={}, keys=[], values=[], sorter, i, k, populateArr = []; if (typeof by_value == 'undefined') { by_value = false;} if (typeof reverse == 'undefined') { reverse = false;} if (typeof numeric != 'undefined') { sorter = function (a, b) { if (!is_numeric(a) && !is_numeric(b)) { if (a.search(/a[n]? /i) === 0) { a = a.substr(a.indexOf(" ")+1); } if (b.search(/a[n]? /i) === 0) { b = b.substr(b.indexOf(" ")+1); } if (a == b) { return 0; } if (a < b) { return -1; } return 1; }     else { a = parseFloat(a.replace(/[^0-9.-]/g,)) || 0; b = parseFloat(b.replace(/[^0-9.-]/g,)) || 0; return a - b;     } } }  else { sorter = function (a, b) { if (a == b) { return 0; } if (a < b) { return -1; } return 1; }; } // Flip keys and values if (by_value) { for (k in inputArr) { tmp_arr[inputArr[k]] = k; } inputArr = tmp_arr; tmp_arr={}; } // Make a list of key names for (k in inputArr) { if (inputArr.hasOwnProperty) { keys.push(k); } } keys.sort(sorter); if (reverse) { keys = keys.reverse; } // Rebuild array with sorted key names for (i = 0; i < keys.length; i++) { k = keys[i]; tmp_arr[k] = inputArr[k]; } for (i in tmp_arr) { if (tmp_arr.hasOwnProperty) { populateArr[i] = tmp_arr[i]; } } // Flip keys and values back if (by_value) { tmp_arr={}; for (k in populateArr) { tmp_arr[populateArr[k]] = k; } populateArr = tmp_arr; } return populateArr; } function ksort (inputArr, numeric) { var tmp_arr={}, keys=[], sorter, i, k, populateArr = []; if (typeof numeric != 'undefined') { sorter = function (a, b) { if (!is_numeric(a) && !is_numeric(b)) { if (a.search(/a[n]? /i) == 0) { a = a.substr(a.indexOf(" ")+1); } if (b.search(/a[n]? /i) == 0) { b = b.substr(b.indexOf(" ")+1); } if (a == b) { return 0; } if (a < b) { return -1; } return 1; }     else { a = parseFloat(a.replace(/[^0-9.-]/g,)) || 0; b = parseFloat(b.replace(/[^0-9.-]/g,)) || 0; return a - b;     } } }  else { sorter = function (a, b) { if (a == b) { return 0; } if (a < b) { return -1; } return 1; }; } // Make a list of key names for (k in inputArr) { if (inputArr.hasOwnProperty) { keys.push(k); } } keys.sort(sorter); // Rebuild array with sorted key names for (i = 0; i < keys.length; i++) { k = keys[i]; tmp_arr[k] = inputArr[k]; } for (i in tmp_arr) { if (tmp_arr.hasOwnProperty) { populateArr[i] = tmp_arr[i]; } } return populateArr; }

/* a is item name, b is item count */ function wikimarkup(a, b) { a = stripslashes(a); var tmp = (a.indexOf(" ") == -1) ? a.length : a.indexOf(" "); tmp = [a.slice(0, tmp), a.substr(tmp+1)]; if (ucwords(tmp[0]) == "Nothing") { return "|Empty, "+b+"\r\n"; } else if (ucwords(tmp[0]) == "A" || ucwords(tmp[0]) == "An") { return "|"+tmp[1]+", "+b+"\r\n"; } else if (is_numeric(tmp[0])) { //check if last letter is s 	var lastletter = tmp[1].substr(-1); if (lastletter == "s") { //remove the s     var itemname = tmp[1].substr(0, tmp[1].length - 1); //need to check if the last letters are 'ie', so we can replace it with 'y'     lastletter = itemname.substr(-2); //reuse variable, heh if (lastletter == "ie") { var newitemname = itemname.substr(0, itemname.length - 2); newitemname += "y"; return "|"+tmp[0]+" "+itemname+"s, "+b+"\r\n"; }     else { return "|"+tmp[0]+" "+itemname+"s, "+b+"\r\n"; }   }    else { //leave last letter, it isnt a s!     return "|"+tmp[0]+" "+tmp[1]+", "+b+"\r\n"; } }  else { return "|"+a+", "+b+"\r\n"; } }

var newdiv; function lootparser_loot_process { /* start execution time counter */ var starttime = new Date; starttime = starttime.getTime; /* end execution time counter */

//Cleaning DOM var rdel, i = 0, results = document.getElementById('lootparser_loot_results'); while (rdel = gebi('lootparser_loot_results'+i)) { results.removeChild(rdel); i++; } results.innerHTML = ""; gebi('lootparser_loot_totallines').innerHTML = ""; gebi('lootparser_loot_totaltime').innerHTML = ""; /* monsters[x] = y x = monster name y = amount of x killed */ var monsters = {}; /* totalloot[x][y] = z x = monster name y = item name z = item count 1 holds all items seperate 2 will add all items that have the same name */ var totalloot1 = {}; var totalloot2 = {}; /* total amount of gold */ var totalgold = {}; //lets analyse the data var data = trim(gebi('lootparser_loot_log').value).split("\n"); var totallines = data.length; gebi('lootparser_loot_totallines').innerHTML = "Analysing "+totallines+" lines..."; var x, info, loot, monster; var y, itemlooted, tmp; var lastletter, itemname; for (x in data) { info = data[x].indexOf("Loot of"); //info = split("Loot of", $value); if (info > -1) { info = data[x].substr(info+8) loot = trim(info.substr(info.indexOf(":") + 1)); monster = trim(info.slice(0, info.indexOf(":"))); if (typeof monsters[monster] == 'undefined') { monsters[monster] = 1; } else { monsters[monster]++; } loot = loot.split(","); for (y in loot) { //sorting loot itemlooted = ucwords(trim(loot[y])); //the name of the looted item, capitalised itemlooted = itemlooted.replace("Of", "of"); //"of" shouldn't be capitalised if (typeof totalloot1[monster] == 'undefined') { totalloot1[monster] = {}; totalloot2[monster] = {}; } if (typeof totalloot1[monster][itemlooted] == 'undefined') { totalloot1[monster][itemlooted] = 1; } else { totalloot1[monster][itemlooted]++; } /* Start sorting all of the same items for totalloot2 */ tmp = itemlooted.indexOf(" "); tmp = [itemlooted.slice(0, tmp), itemlooted.substr(tmp+1)]; if (ucwords(tmp[0]) == "A" || ucwords(tmp[0]) == "An") { if (tmp[1] == "Gold Coin") {//add a gold coin if (typeof totalgold[monster] == 'undefined') { totalgold[monster] = 1; } else { totalgold[monster]++; } }         if (typeof totalloot2[monster][tmp[1]] == 'undefined') { totalloot2[monster][tmp[1]] = 1; } else { totalloot2[monster][tmp[1]]++; } }       else if (is_numeric(tmp[0])) { itemlooted = itemlooted.replace("A", "a"); //"a" shouldn't be capitalised if (tmp[1] == "Gold Coins") {//increase total amount of gold if (typeof totalgold[monster] == 'undefined') { totalgold[monster] = parseInt(tmp[0]); } else { totalgold[monster] += parseInt(tmp[0]); } }         lastletter = tmp[1].substr(-1); if (lastletter == "s") { //remove the s           itemname = tmp[1].substr(0, tmp[1].length - 1); //need to check if the last letters are 'ie', so we can replace it with 'y'           lastletter = itemname.substr(-2); //reuse variable, heh //need to check if the last letters are 'ie', so we can replace it with 'y'           if (lastletter == "ie") { itemname = itemname.substr(0, itemname.length - 2); itemname += "y"; }           else if (lastletter == "ve") { itemname = itemname.substr(0, itemname.length - 2); itemname += "fe"; }           if (typeof totalloot2[monster][itemname] == 'undefined') { totalloot2[monster][itemname] = parseInt(tmp[0]); } else { totalloot2[monster][itemname] += parseInt(tmp[0]); } }         //last letter isn't a s          else { if (typeof totalloot2[monster][tmp[1]] == 'undefined') { totalloot2[monster][tmp[1]] = parseInt(tmp[0]); } else { totalloot2[monster][tmp[1]] += parseInt(tmp[0]); } }       }        //no "a, an" or number, so put full item name else { itemlooted = itemlooted.replace("A", "a"); //"a" shouldn't be capitalised if (typeof totalloot2[monster][itemlooted] == 'undefined') { totalloot2[monster][itemlooted] = 1; } else { totalloot2[monster][itemlooted]++; } }     }    }  }  var id_inc = 0; var in_tmp = ""; //Sort for (x in totalloot1) { totalloot1[x] = ksort(totalloot1[x], true); totalloot2[x] = ksort(totalloot2[x]); } var tl1 = 0; for (x in totalloot1) tl1++; if (tl1 === 0) { results.innerHTML = "No monsters killed!"; } else { newdiv = document.createElement('div'); newdiv.setAttribute('id', 'lootparser_loot_results'+id_inc); id_inc++; in_tmp = '   ";    newdiv.innerHTML = in_tmp;    results.appendChild(newdiv); /* k1 = monster name totalloot1[k1] = loot array of key1 k2 = item name in totalloot1 totalloot1[k1][k2] = item count in totalloot1 k3 = item name in totalloot2 totalloot2[k1][k3] = item count in totalloot2    var tmpvar, monstername;    var output1, output2, output3;    var k1, k1c, k2, k3;    var lowercase;    for (k1 in totalloot1) {      newdiv = document.createElement('div');      newdiv.setAttribute('id', 'lootparser_loot_results'+id_inc); id_inc++; //determine monster name      k1c = ucwords(k1);      tmpvar = k1c.indexOf(" "); tmpvar = [k1c.slice(0, tmpvar), k1c.substr(tmpvar+1)];      if (tmpvar[0] == "A" || tmpvar[0] == "An") { monstername = tmpvar[1]; }      else { monstername = k1; }      output1 = output2 = output3 = "";      in_tmp = 'up - Killed '+monsters[k1]+'x '+k1+', which dropped:'; for (k2 in totalloot1[k1]) { lowercase = stripslashes(k2.toLowerCase); output1 += totalloot1[k1][k2] + "x "+lowercase+" \n\r"; if (ucwords(k2) == "Nothing") { output2 = wikimarkup(k2, totalloot1[k1][k2]) + output2; } else { output2 += wikimarkup(k2, totalloot1[k1][k2]); } }     for (k3 in totalloot2[k1]) { if (ucwords(k3) == "Nothing") { output3 = wikimarkup(k3, totalloot2[k1][k3]) + output3; } else { output3 += wikimarkup(k3, totalloot2[k1][k3]); } }     output1 = '  ' + ''+output1+' ';

in_tmp += output1 + ' ';      newdiv.innerHTML = in_tmp; results.appendChild(newdiv); } } /* start execution time counter */ var endtime = new Date; endtime = endtime.getTime; var totaltime = Math.round((endtime - starttime)*1000); gebi('lootparser_loot_totaltime').innerHTML = "Calculation made in "+(totaltime/1000000)+" seconds"; /* end execution time counter */ }

function upload_to_wikia(div_id) { gebi('lootparser_loot_combined_b'+div_id).disabled = true; var divtodo = gebi('lootparser_loot_combined'+div_id); //Function to add data to each monster page if ((typeof lootparser_ajax_add) != 'function') { function lootparser_ajax_add(newtext, monster, wpp) { var lootparser_loot_t; if ((lootparser_loot_t = getXmlHttpRequestObject) == false) { return; } lootparser_loot_t.onreadystatechange = function { if (lootparser_loot_t.readyState != 4) { return; } //fix add more responses if (lootparser_loot_t.status == 200) { alert('Loot added to the creature page for '+monster); } else { alert('Problems found while uploading loot, you may need to check the loot statistics page for '+monster); } }; //   newtext = newtext.replace(/&lt;/g,'<').replace(/&gt;/g,'>'); var bound2 = '--u9NhcWCckcbMykvMxYdPSR'; var bound = '--'+bound2; //var params = 'wpTextbox1='+encodeURIComponent(newtext); var params = '\r\n'+bound+'\r\n'+'Content-Disposition: form-data; name="wpCategorySelectWikitext"\r\n\r\n'+'[]'+'\r\n'+ bound+'\r\n'+'Content-Disposition: form-data; name="wpCategorySelectSourceType"\r\n\r\n'+'json'+'\r\n'+ bound+'\r\n'+'Content-Disposition: form-data; name="wpLogin"\r\n\r\n'+'\r\n'+ bound+'\r\n'+'Content-Disposition: form-data; name="wpSection"\r\n\r\n'+'\r\n'+ bound+'\r\n'+'Content-Disposition: form-data; name="wpStarttime"\r\n\r\n'+wpp['wpStarttime']+'\r\n'+ bound+'\r\n'+'Content-Disposition: form-data; name="wpEdittime"\r\n\r\n'+wpp['wpEdittime']+'\r\n'+ bound+'\r\n'+'Content-Disposition: form-data; name="wpScrolltop"\r\n\r\n'+'0'+'\r\n'+ bound+'\r\n'+'Content-Disposition: form-data; name="wpAutoSummary"\r\n\r\n'+wpp['wpAutoSummary']+'\r\n'+ bound+'\r\n'+'Content-Disposition: form-data; name="wpTextbox1"\r\n\r\n'+newtext+'\r\n'+ bound+'\r\n'+'Content-Disposition: form-data; name="csWikitext"\r\n\r\n'+'\r\n'+ bound+'\r\n'+'Content-Disposition: form-data; name="wpSummary"\r\n\r\n'+'Kills added with tibia wikia loot parser'+'\r\n'+ bound+'\r\n'+'Content-Disposition: form-data; name="wpSave"\r\n\r\n'+'Save page'+'\r\n'+ bound+'\r\n'+'Content-Disposition: form-data; name="wpEditToken"\r\n\r\n'+wpp['wpEditToken']+'\r\n'+ bound+'\r\n'+'Content-Disposition: form-data; name="antispam"\r\n\r\n'+wpp['antispam']+'\r\n'+ bound+'--'; lootparser_loot_t.open("POST", '/index.php?title='+monster+'/Loot_Statistics&action=submit'); lootparser_loot_t.setRequestHeader("Content-length", params.length); lootparser_loot_t.setRequestHeader("Content-Type", 'multipart/form-data; boundary='+bound2); lootparser_loot_t.send(params); lootparser_loot_t.send(null); } }

//Function to check data to be added to each monster page if ((typeof lootparser_ajax_addcheck) != 'function') { function lootparser_ajax_addcheck(newtext, monster) { var lootparser_loot_t; if ((lootparser_loot_t = getXmlHttpRequestObject) == false) { return; } lootparser_loot_t.onreadystatechange = function { if (lootparser_loot_t.readyState != 4) { return; } var oldtext = text = lootparser_loot_t.responseText; if ((oldtext = oldtext.match(/([\s\S]*?)<\/textarea>/i)) == null) { alert('There was a problem trying to get statistics for '+monster); return false; }     oldtext = trim(oldtext[1]);//oldtext = wikia textarea contents /*     if (oldtext !== '' && oldtext !== ('&'+'lt;p /&'+'gt;')) { //Data found, add old+new data to newtext*/ newtext = newtext.slice(newtext.search('{'+'{'), newtext.search('}'+'}')+2);//Take only the Template part if ((newtext = lootparser_add(oldtext, newtext)) == false) { return; }; /*     }*/      var matches, x, wpp = {'wpStarttime':, 'wpEdittime':, 'wpAutoSummary':, 'wpEditToken':, 'antispam':''}; for (x in wpp) {//Extra data for wikia edits matches = text.match(new RegExp(']*name=["\']'+x+'["\'][^>]*)>', 'i')); wpp[x] = matches[1].match(/value=["']([\s\S]*?)["']/i)[1] || ''; }     lootparser_ajax_add(newtext, monster, wpp); };   lootparser_loot_t.open('GET', '/index.php?title='+monster+'/Loot_Statistics&action=edit'); lootparser_loot_t.send(null); } } var mdata, wdata, rp; i = 1; results = document.getElementById('lootparser_loot_results');

wdata = divtodo.innerHTML; if ((mdata = wdata.match(/\{\{[\s\S]*?name=([\s\S]*?)\|[\s\S]*?\}\}/i)) == null) { alert('There was a problem trying to get statistics from page(2)'); return; } mdata = ucwords(trim(mdata[1])).replace(' ', '_'); lootparser_ajax_addcheck(wdata, mdata); }

//textold can be an input from a wiki textarea //textnew should be generated by lootparser_loot_process //Gives alert and returns false on failure function lootparser_add(textold, textnew, wysiwygtag) { var errors = ['Wrong data in input to be added', 'Wrong data in original input', 'Names of creatures doesn\'t match', 'names/kills/version is missing'];

if (typeof wysiwygtag == 'undefined') { wysiwygtag = true; } var textoldo = textold; //original old text textnew = textnew.slice(textnew.search('{'+'{'), textnew.search('}'+'}')+2);//Take only the Template part textnew = textnew.slice(textnew.search(/\|/)+1, textnew.search('}'));//Take only the parameters var textnewa = textnew.split(/[\s]{1,2}\|/);//make it an warray var textoldao = {}, textnewao = {}, x, tmp; for (x in textnewa) { //parse values into an associative array if (textnewa[x].search('=') != -1) { tmp = textnewa[x].split('='); } else if (textnewa[x].search(',') != -1) { tmp = textnewa[x].split(','); } else { alert(errors[0]+'(0)'); return false; } tmp[0] = trim(tmp[0]); tmp[1] = trim(tmp[1]); textnewao[tmp[0]] = tmp[1]; if (tmp[0] == 'name') { textnewao['name'] = ucwords(textnewao['name']); } if (tmp[0] == 'name' || tmp[0] == 'version') { continue; } if (!is_numeric(tmp[1])) { alert(errors[0]+'(1)'); return false; } } //Looking for matching version number on textold & textnew var matches, vo, vn, textold_match = false; matches = textold.match(/\{\{[\s\S]*?\|[\s]{0,1}version=[\s\S]*?[\s]{0,3}?\|[\s\S]*?\}\}(?:[\s\S]{0,20}Average [\[]{0,2}gold[\]]{0,2}:[\s]{0,3}[\d\.]*[\s]?[\w]{0,6}|[\s\S]*?)/gi); var vo, vn; for (x in matches) { vo = matches[x].match(/[\s\S]*version=([\s\S]*?)[\s]{0,3}?\|[\s\S]*/i)[1]; vn = textnew.match(/[\s\S]*version=([\s\S]*?)[\s]{0,3}?\|[\s\S]*/i)[1]; if (vo == vn) { textold_match = matches[x]; break; } }  if (textold_match == false) { textoldao = textnewao; } //will insert the new loot at beginning of page else { //will add the new loot to an existing one textold = textold_match; textold = textold.slice(textold.search('{'+'{'), textold.search('}'+'}')+2);//Take only the Template part textold = textold.slice(textold.search(/\|/)+1, textold.search('}'));//Take only the parameters var textolda = textold.split(/[\s]{1,2}\|/); for (x in textolda) {//parse values into an associative array and sum the new loots if (textolda[x].search('=') != -1) { tmp = textolda[x].split('='); } else if (textolda[x].search(',') != -1) { tmp = textolda[x].split(','); } else { alert(errors[1]+'(2)'); return false; } tmp[0] = trim(tmp[0]); tmp[1] = trim(tmp[1]); textoldao[tmp[0]] = trim(tmp[1]); if (tmp[0] == 'version') { continue; } if (tmp[0] == 'name') { textoldao['name'] = ucwords(textoldao['name']); if (textnewao['name'] != textoldao['name']) { alert(errors[2]+'(3)'); return false; } continue; }     if ((!is_numeric(trim(tmp[1])))) { alert(errors[1]+'(4)'); return false; } if (tmp[0] in textnewao) { textoldao[tmp[0]] = parseInt(textnewao[tmp[0]]) + parseInt(textoldao[tmp[0]]); delete textnewao[tmp[0]]; }   }    for (x in textnewao) { textoldao[x] = textnewao[x]; }//add the loots not present on old loots } //Generating wiki markup var avgold = Math.round((textoldao['Gold Coin'] / textoldao['kills']) *100)/100 || 0; var out = "{"+"{Loot\n"; if ('name' in textoldao && 'kills' in textoldao && 'version' in textoldao) {//1st values out += '|version=' + textoldao['version'] + "\n"; out += '|kills=' + textoldao['kills'] + "\n"; out += '|name=' + textoldao['name'] + "\n"; if ('Empty' in textoldao) { out += '|Empty=' + textoldao['Empty'] + "\n"; } delete textoldao['version']; delete textoldao['kills']; delete textoldao['name']; delete textoldao['Empty']; } else { alert(errors[3]+'(5)'); return false; } textoldao = array_sort(textoldao, true, true, true); for (x in textoldao) { out += '|' + x + ', ' + textoldao[x] + '\n'; } //Rest of values out += "}"+"}"; out += '\r\n Average gold: '+ avgold;

var res = (!textold_match ? out+'\n\n\n'+textoldo : textoldo.replace(textold_match, out)); res = (wysiwygtag ? '__NOWYSIWYG__\n\n' : ) + res.replace('__NOWYSIWYG__', );

while (res.search('\r\n\r\n\r\n') != -1) { res = res.replace('\r\n\r\n\r\n', '\r\n\r\n'); alert(0); } while (res.search('\r\r\r') != -1) { res = res.replace('\r\r\r', '\r\r'); alert(1); } while (res.search('\n\n\n') != -1) { res = res.replace('\n\n\n', '\n\n'); alert(2); } while (res.search('&amp;') != -1) { res = res.replace('&amp;', '&'); alert(3); } while (res.search('&lt;') != -1) { res = res.replace('&lt;', '<'); alert(res.search('&lt;')+'-4-'+res.length); } while (res.search('&gt;') != -1) { res = res.replace('&gt;', '>'); alert(5); } while (res.search('') != -1) { res = res.replace('', ''); alert(6); } return res; }

function lootparser_add_process {

lootparser_add_results /* start execution time counter */ var starttime = new Date; starttime = starttime.getTime; /* end execution time counter */ var tmp = lootparser_add(gebi('lootparser_add_log1').value, gebi('lootparser_add_log2').value); gebi('lootparser_add_results').value = (!tmp ? '' : tmp); /* start execution time counter */ var endtime = new Date; endtime = endtime.getTime; var totaltime = Math.round((endtime - starttime)*1000); gebi('lootparser_add_totaltime').innerHTML = "Calculation made in "+(totaltime/1000000)+" seconds"; /* end execution time counter */ }

function lootparser_add_init { newdiv = document.createElement('div'); newdiv.setAttribute('id', 'lootparser_add_main1'); newdiv.setAttribute('style', 'display: none;'); newdiv.innerHTML = 'Please copy the "old" loot statistics in the left box, then copy the ones that need to be added to it into the right one. '+ 'You can have several statistics on the "old" page and as long as they have correct version they will be processed with no problem. '+ 'If any problems arrise using this script version, please contact me (Daniel Letalis) on my talk page '+ 'on tibia.wikia.com '+ ' '+ ' '+  ' '+  ' '+ '<input type="button" value="Clear" onclick="gebi(\'lootparser_add_log1\').value = \'\';gebi(\'lootparser_add_log2\').value = \'\'">'; document.getElementById('lootparser_add').appendChild(newdiv);

newdiv = document.createElement('div'); newdiv.setAttribute('id', 'lootparser_add_main2'); newdiv.setAttribute('style', 'display: none;'); newdiv.innerHTML = '<input type="button" value="Go back to the form" onclick="hebi(\'lootparser_add_main2\'); sebi(\'lootparser_add_main1\');">'+ ' '+  ' '+  '  '+  '<div id="lootparser_add_totaltime"> '; document.getElementById('lootparser_add').appendChild(newdiv); document.getElementById('lootparser_add').style.backgroundColor = '#EEEEEE'; document.getElementById('lootparser_add').style.padding = '15px'; sebi('lootparser_add_main1'); } function lootparser_loot_init { newdiv = document.createElement('div'); newdiv.setAttribute('id', 'lootparser_loot_main1'); newdiv.setAttribute('style', 'display: none;'); newdiv.innerHTML = 'This script will analyse your Server Log file and will then give you an overview of the monsters killed, and their loot. '+ 'In addition, it will supply you with 2 textboxes, filled with code. This code is to be used on the Loot Statistics</a> page. '+ 'All this is to make your life easier, you do not have to manually count or edit anything. '+ 'If any problems arrise using this script version, please contact me (Daniel Letalis) on my talk page</a> '+ 'on tibia.wikia.com</a> '+ 'Most of the work on this script is from Temahk</a>, I only converted it to Javascript for tibia.wikia.com.'+ ' '+  'Please copy the Server Log in this box: '+ '<textarea id="lootparser_loot_log" rows="15" cols="60" style="width:100%"> '+ ' '+  '<input type="button" value="Process" onclick="hebi(\'lootparser_loot_main1\'); sebi(\'lootparser_loot_main2\');lootparser_loot_process;"> '+ '<input type="button" value="Reset" onclick="gebi(\'lootparser_loot_log\').value = \'\'">'; document.getElementById('lootparser_loot').appendChild(newdiv);

newdiv = document.createElement('div'); newdiv.setAttribute('id', 'lootparser_loot_main2'); newdiv.setAttribute('style', 'display: none;'); newdiv.innerHTML = '<input type="button" value="Go back to the form" onclick="hebi(\'lootparser_loot_main2\'); sebi(\'lootparser_loot_main1\');">'+ ' '+  '<div id="lootparser_loot_totallines"> '+ '<div id="lootparser_loot_results"> '+ ' '+ '<div id="lootparser_loot_totaltime"> '; document.getElementById('lootparser_loot').appendChild(newdiv); document.getElementById('lootparser_loot').style.backgroundColor = '#EEEEEE'; document.getElementById('lootparser_loot').style.padding = '15px'; sebi('lootparser_loot_main1'); } /* End of Code used for Loot_Statistics */

/*Hide bar and show loot parser */ lootparser_add_init; document.getElementById('lootparser_add_img').style.display = 'none'; document.getElementById('lootparser_add').style.display = 'block'; lootparser_loot_init; document.getElementById('lootparser_loot_img').style.display = 'none'; document.getElementById('lootparser_loot').style.display = 'block';