if(location.href.match(/act=Fight&EP=(.*)&UN=(.*)&EN=(.*)&T=(.*)/i)){
var tehmeth=location.href.split("&T=")[1]
}else{
var tehmeth=Math.floor(Math.random()*3);
}
function check(){
if(Ulife<1){
document.getElementById("Killer").innerHTML="<div class=\"tableborder\"><div class=\"maintitle\">Battle ("+Ename+" Vs "+Uname+")</div><div class=\"tablepad\" id='BLoad'><b>To bad, "+Ename+" won</b><br>You've been defeated by "+Ename+"!</div></div>"
}else if(Elife<1){
document.getElementById("Killer").innerHTML="<div class=\"tableborder\"><div class=\"maintitle\">Battle ("+Ename+" Vs "+Uname+")</div><div class=\"tablepad\" id='BLoad'><b>Congratulations "+Uname+"</b><br>You've defeated "+Ename+"!</div></div>"
}else{
T=setTimeout("check()",0.1)
}}
function def(){
Edmg=Elevel*2.5
Edmg=Edmg-Math.floor(Math.random()*Edmg*1.5);
Edmg=Math.round(Edmg)
Ulife=Ulife-Edmg
document.getElementById("LifeU").innerHTML=Ulife
if(Edmg<0){
document.getElementById("tehAction").innerHTML="You blocked your enemys attack and absorbed some damage"
}else if(Edmg>0){
document.getElementById("tehAction").innerHTML="You blocked your enemys attack but you still received some damage"
}else{
document.getElementById("tehAction").innerHTML="You fully blocked your enemys attack"
}}
function att(skip){
Edmg=Elevel*3
Udmg=Ulevel*3
Edmg=Edmg-Math.floor(Math.random()*Edmg*2);
Udmg=Udmg-Math.floor(Math.random()*Udmg*2);
Edmg=Math.round(Edmg)
Udmg=Math.round(Udmg)
if(Udmg<0){
Udmg=Ulevel*1.3
Udmg=Math.round(Udmg)
}
if(Edmg<0){
Edmg=Elevel*1.3
Edmg=Math.round(Edmg)
}
Elife=Elife-Udmg
Ulife=Ulife-Edmg
document.getElementById("tehAction").innerHTML="You inflicted "+Udmg+" damage to your enemy, he returned a damage of "+Edmg
document.getElementById("LifeU").innerHTML=Ulife
document.getElementById("LifeE").innerHTML=Elife
}
function encrypt(spicy){
if(tehmeth==0){
spicy=spicy*0.23
}else if(tehmeth==1){
spicy=spicy*3.98
}else if(tehmeth==2){
spicy=spicy*0.9
}
return spicy
}
function decrypt(spicy){
if(tehmeth==0){
spicy=spicy/0.23
}else if(tehmeth==1){
spicy=spicy/3.98
}else if(tehmeth==2){
spicy=spicy/0.9
}
return spicy
}
if(document.getElementById("userlinks").innerHTML.match(/Logged in as:/i)){
blah=location.href.split("&").length-1
if(location.href.match(/act=Fight/i) && blah==0){
document.getElementById("Killer").innerHTML="<div class=\"tableborder\"><div class=\"maintitle\">Battle</div><div class=\"tablepad\">"+INSTR+"</div></div>"
}else if(location.href.match(/act=Fight&EP=(.*)&UN=(.*)&EN=(.*)&T=(.*)/i)){
Uname=location.href.split("&UN=")[1].split("&EN=")[0]
Ename=location.href.split("&EN=")[1].split("&T=")[0]
Epost=decrypt(location.href.split("&EP=")[1].split("&UN=")[0])
document.getElementById("Killer").innerHTML="<div class=\"tableborder\"><div class=\"maintitle\">Battle ("+Ename+" Vs "+Uname+")</div><div class=\"tablepad\" id='BLoad'><b>Loading required information for battle...</b></div></div>"
function Bstart(){
a=window.self.frames["PCFrame"].document.getElementsByTagName("td")
for(i=0;i<a.length;i++){
if(a[i].innerHTML.match(/Total Cumulative Posts/i)){
Upost=a[i].parentNode.getElementsByTagName("b")[1].innerHTML
Ulevel=perpostxp*Upost
Ulevel=Ulevel/xpinlevel+1
for(blah in edit){
if(blah==Uname){
Ulevel = parseInt(Ulevel)+parseInt(edit[blah][1])
break
}}
Elevel=perpostxp*Epost
Elevel=Elevel/xpinlevel+1
for(blah in edit){
if(blah==Ename){
Elevel = parseInt(Elevel)+parseInt(edit[blah][1])
break
}}
Elife=5*Elevel+10
Ulife=5*Ulevel+10
Elife=Math.round(Elife)
Ulife=Math.round(Ulife)
}}
document.getElementById("BLoad").innerHTML="<div class='tableborder'><div class='maintitle'>Battle information </div><table width='100%' border='0' cellspacing='1' cellpadding=\4'><tr><th class='pformstrip' width='25%'>Name</th><th class='pformstrip' align='center' width='25%'>Level</th><th class='pformstrip' align='center' width='25%'>Life</th></tr><tr><td class='row4'><strong>"+Uname+"</strong></td><td class='row4'><strong>"+Ulevel+"</strong></td><td class='row4'><strong><span id='LifeU'>"+Ulife+"</span></strong></td></tr><tr><td class='row2' width='25%'><strong>"+Ename+"</strong></td><td class='row4' width='25%'><strong>"+Elevel+"</strong></td><td class='row4'><strong><span id='LifeE'>"+Elife+"</span></strong></td></tr></table></div><div class='tableborder'><div class='pformstrip'><table width='100%' border='0' cellspacing='1' cellpadding=\4'><tr><td align='center' id='tehAction'><!--RAWr--></td></tr><tr><td align='center'><a href='javascript:att()'>Attack!</a> - <a href='javascript:def()'>Defend!</a></td></tr></table></div></div>"
check()
}
document.write("<iframe src='"+document.getElementById("userlinks").getElementsByTagName("a")[0].href+"' style='display:none' name='PCFrame' id='PCFrame' onload='Bstart()'></iframe>")
}}
if(location.href.match(/showtopic=/i)){
uname="Guest"
name="Guest"
if(document.getElementById("userlinks").innerHTML.match(/Logged in as:/i)){
uname=document.getElementById("userlinks").getElementsByTagName("a")[0].innerHTML
}
var evil=document.getElementsByTagName("span")
for(laugh=0;laugh<evil.length;laugh++){
if(evil[laugh].className=="postdetails" && evil[laugh].innerHTML.match(/Posts: (\d+)/)){
name= evil[laugh].parentNode.parentNode.parentNode.rows[0].cells[0].getElementsByTagName("A")[0];
name=name.firstChild
name=name.nodeValue
postcount = RegExp.$1
curmoney = moneyperpost*postcount
curmoney = parseInt(curmoney)+parseInt(moneystart)
curexp = postcount*perpostxp
curlevel = curexp/xpinlevel
curlevel = curlevel+1
for(blah in edit){
if(blah==name){
curmoney = parseInt(curmoney)+parseInt(edit[blah][0])
curlevel = parseInt(curlevel)+parseInt(edit[blah][1])
break
}}
if(curlevel>100){
curlevel=100
}else if(curlevel<1){
curlevel=1
}
if(curmoney<0){
curmoney=0
}
evil[laugh].innerHTML+="<br><b>PVP information</b><br>"+moneyname+": "+moneysign+curmoney+",-<br>Level: "+curlevel+"<br>Exp: "+curexp
if(name!=uname){
evil[laugh].innerHTML+="<br><a href='"+location.href.split("?")[0]+"?act=Fight&EP="+encrypt(postcount)+"&UN="+uname+"&EN="+name+"&T="+tehmeth+"'>Battle "+name+"!</a>"
}
curlevel=0
curmoney=0
}}}
