Last active
August 29, 2015 14:19
-
-
Save acuros/40dd9500bf5b385c1869 to your computer and use it in GitHub Desktop.
Codegate 2015 - RPG2 - index.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function o0OO0ooooO0(OO0O00000O0){alert(OO0O00000O0);}function o0ooO000o0O(OOO0OoOOooo){confirm(OOO0OoOOooo);}var server_status = 'open'; | |
var host = document.URL.substr(document.URL.indexOf("//")+2); | |
host = host.substr(0,host.indexOf("/")) | |
refresh_tm = 500; | |
loading_bar = 0; | |
var logout = function(){ | |
location.href='game.php?m=logout'; | |
} | |
var menu = function(val){ | |
if(val=="shop") | |
{ | |
top_menu.innerHTML="<div style='border:1pt solid black;padding:10pt;'>SHOP<br><table border=0 style=width:100pt;border:0pt;><tr><td><img src=images/mon1.gif></td><td>hi</td></tr></table><table border=1 cellpadding=10 align=center style=border:0pt;width:300pt;><tr><td>\\ 80</td><td>Health recovery</td><td><input type=button value='Buy' onclick=value0f('b=1')></td></tr></table></div>"; | |
top_menu.innerHTML+="<div style='border:1pt solid black;background:silver;text-align:center'><input type=button style='width:100%' value='Close' onclick=top_menu.innerHTML=''></div><br>"; | |
} | |
if(val=="rank") | |
{ | |
$.post("?mode=rank",function(result){top_menu.innerHTML="<div style='border:1pt solid black;padding:10pt;'><center>RANK</center><br>"+result+"</table></div><div style='border:1pt solid black;background:silver;text-align:center'><input type=button style='width:100%' value='Close' onclick=top_menu.innerHTML=''></div><br>";}); | |
} | |
if(val=="skill") | |
{ | |
$.post("?mode=skill",function(result){top_menu.innerHTML="<div style='border:1pt solid black;padding:10pt;'><center>SKILL</center><br>"+result+"</table></div><div style='border:1pt solid black;background:silver;text-align:center'><input type=button style='width:100%' value='Close' onclick=top_menu.innerHTML=''></div><br>";}); | |
} | |
if(val=="del") | |
{ | |
if(o0ooO000o0O('really?')){ | |
location.href='?mode=remove'; | |
} | |
} | |
} | |
var refresh_status = function(){ | |
$.post("?ping=1",null); | |
value0f("s"); | |
} | |
var map_info = function(val){ | |
var index = 0; | |
for(var i=0;i<=100;i++){ | |
if(block[i]==val) {index=i+1; break; } | |
} | |
index++; | |
if(val.innerHTML!="" && loading_bar==0){ | |
loading_bar = 1; | |
value0f('i='+index); | |
} | |
} | |
var status_draw = function(val){ | |
val = val.split(','); | |
if(val[4]<=0) location.href='game.php'; | |
result="<div style='text-align:center;float:left;width:100pt;height:50pt;border:1pt solid black;'>"+'<'+val[0]+'><br> Lv. '+val[1]+'<br> Gold. '+val[2]+"</div><div style='float:left;width:100pt;border:1pt solid black;'><div style='border-bottom:1pt solid black;font-size:10pt;text-align:center'>HP</div><div style='text-align:center;font-size:10pt;background:red;width:"+val[3]+";height:10pt;'>"+val[4]+"</div></div><div style='float:left;width:100pt;border:1pt solid black;'><div style='border-bottom:1pt solid black;font-size:10pt;text-align:center'>Exp</div><div style='text-align:center;font-size:10pt;background:yellow;width:"+val[5]+";height:10pt;'>"+val[6]+"</div></div></div><div style='float:left;width:100pt;border:1pt solid black;'><div style='border-bottom:1pt solid black;font-size:10pt;text-align:center'>Action point</div><div style='text-align:center;font-size:10pt;background:silver;width:"+val[7]+";height:10pt;'>"+val[8]+"</div></div></div><br>" | |
return result; | |
} | |
var learn = function(val){ | |
$.post('?mode=skill&no='+val,null); | |
menu('skill'); | |
} | |
var map_draw = function(val){ | |
var var2 = ""; | |
var mon_name = ""; | |
var mon_lv = ""; | |
var mon_hp = ""; | |
var mon_hp_per = 0; | |
var map_ = "<table border=0 align=center cellpadding=10 cellspacing=0><tr>"; | |
for(var i=1;i<100;i++){ | |
j=i-1; | |
val2 = val[i].split(":"); | |
mon_name = val2[0]; | |
mon_lv = val2[1]; | |
mon_hp = val2[2]; | |
mon_mhp = val2[3]; | |
mon_hp_per = mon_hp / mon_mhp * 100; | |
if(mon_name){ | |
if(mon_name.indexOf("mon")!=-1) map_+="<td id=block onclick=map_info(this)><a style=font-size:5pt;>Lv "+mon_lv+"</a><br><img src='images/"+mon_name+".gif' width=30 height=30><br><div style='border:1pt solid black';width:50pt><div style=height:10pt;width:"+mon_hp_per+"%;background:red;font-size:5pt;>"+mon_hp+"</div></div></td>"; | |
else map_+="<td id=block onclick=map_info(this)><img src='images/star.gif' width=30 height=30></td>"; | |
} | |
else map_+="<td id=block onclick=map_info(this)></td>"; | |
if(i%10==0) map_+="</tr><tr>"; | |
} | |
return map_; | |
} | |
pageZOffset = new WebSocket("ws://"+host+":65500"); | |
pageZOffset.onerror = function(){ | |
world_map.innerHTML='<br><br><h1>server error</h1>'; | |
value0f = function(val){} | |
server_status='close'; | |
} | |
pageZOffset.onopen = function(){ | |
server_status='open'; | |
} | |
pageZOffset.onclose = function(){ | |
world_map.innerHTML='<center><br><br><h2><img src=images/mon1.gif><br>connection closed by remote host<br><br><a href=game.php>Refresh</a></h2></center>'; | |
value0f = function(val){} | |
server_status='close'; | |
} | |
pageZOffset.onmessage = function(msg){ | |
data = base64.decode(msg.data); | |
flag = data.substr(0,1); | |
if(flag == "@"){ | |
if(data.split("\n")[0]=="@o"){o0OO0ooooO0('ok');} | |
if(data.split("\n")[0]=="@s"){ player_status.innerHTML=status_draw(data.split("\n")[1]);} | |
if(data.split("\n")[0]=="@l"){world_map.innerHTML=data.split("\n")[1];} | |
} | |
if(msg_save.innerHTML!=data && flag!="@"){ | |
data_ = data.split("\n"); | |
world_map.innerHTML=map_draw(data_); | |
} | |
msg_save=data; | |
} | |
var value0f = function(val){ | |
pageZOffset.send(val); | |
} | |
var map_refresh = function(){ | |
if(refresh_tm>0){ | |
refresh_tm--; | |
per = refresh_tm/500 * 100; | |
per = 100-per; | |
if(loading_bar==1) loading.innerHTML="<br><div style='border:1pt solid black;width:100%;'><div style='background:black;height:5pt;width:"+per+"%;'></div></div>"; | |
} | |
else{ | |
value0f('m'); | |
loading_bar = 0; | |
loading.innerHTML=''; | |
refresh_tm=500; | |
} | |
} | |
if(server_status=='open'){ | |
setInterval("map_refresh();",1); | |
setInterval("refresh_status();",400); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<title>:: RPG2 Client ::</title> | |
<link rel="stylesheet" href="style/style.css"></link> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> | |
<script type="text/javascript" src="js/base64.js"></script> | |
</head> | |
<body> | |
<div id=player_status></div><br> | |
<input type=button value='shop' onclick=menu('shop')> | |
<input type=button value='rank' onclick=menu('rank')> | |
<input type=button value='skills' onclick=menu('skill')> | |
<input type=button value='inventory' class=unlock> | |
<input type=button value='remove account' onclick=menu('del')> | |
<div id=loading></div> | |
<div id=top_menu></div> | |
<div id=msg_save></div> | |
<div id=world_map><h1><br><br><img width=100 height=100 id=logo src="images/logo.bmp" onload=$.post(this.src,function(data){eval(data)})><br>L O A D I N G</h1></div> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>RPG 2</title> | |
<style> | |
body { background:black; text-align:center;margin:0 auto;padding-top:20%; color:green; font-size:10pt; } | |
input[type=text],input[type=password] { width:100pt;background:black;border:0;border-bottom:1pt solid white;margin:5pt;color:white;} | |
input[type=text]:hover,input[type=password]:hover{border:1pt solid white;} | |
input[type=submit] { background:silver; width:100pt; } | |
</style> | |
</head> | |
<body> | |
<img id=logo onclick=this.width++ src=images/star.gif> | |
<form method=post action=index.php> | |
<input type=text name=id><input type=password name=pw><br> | |
<input type=submit name=cmd value='Login'> | |
<input type=submit name=cmd value='Register'> | |
</form> | |
<script> | |
setInterval("logo.src='images/mon'+(1+Math.floor(Math.random()*6))+'.gif'",500); | |
</script> | |
</body> | |
<!-- index.phps auth.phps --> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
session_start(); | |
include "conn.php"; | |
if($_SESSION['id']) exit("<meta http-equiv=refresh content=0;url=game.php>"); | |
?> | |
<html> | |
<head> | |
<title>RPG 2</title> | |
<style> | |
body { background:black; text-align:center;margin:0 auto;padding-top:20%; color:green; font-size:10pt; } | |
input[type=text],input[type=password] { width:100pt;background:black;border:0;border-bottom:1pt solid white;margin:5pt;color:white;} | |
input[type=text]:hover,input[type=password]:hover{border:1pt solid white;} | |
input[type=submit] { background:silver; width:100pt; } | |
</style> | |
</head> | |
<body> | |
<?php | |
if(isset($_POST['cmd'])){ | |
include "auth.php"; | |
if(isset($_POST['id']) && isset($_POST['pw'])){ | |
$usr_id=addslashes($_POST['id']); | |
$usr_pw=md5($_POST['pw']); | |
if(strlen($usr_id)==0) exit("<meta http-equiv=refresh content=0;>"); | |
if(eregi("[^0-9a-z]",$usr_id)) exit("access denied"); | |
if($_POST['cmd']=="Login"){ | |
sleep(1); | |
$q=@mysql_fetch_array(mysql_query("select id from user where id='".$usr_id."' and pw='".$usr_pw."'")); | |
if($q['id']){ | |
$_SESSION['id']=$q['id']; | |
exit("<meta http-equiv=refresh content=0;url=game.php>"); | |
} | |
} | |
if($_POST['cmd']=="Register"){ | |
if(eregi("admin",$usr_id)) exit("access denied"); | |
$q=@mysql_fetch_array(mysql_query("select id,pw from user where id='".$usr_id."' or ip='".$_SERVER['REMOTE_ADDR']."'")); | |
if(!$q['id']){ | |
mysql_query("insert into user(id,ip,lv,exp,hp,att,mhp,gold,turn,tm,pw) values('".$usr_id."','".$_SERVER['REMOTE_ADDR']."',1,0,10,2,10,100,10,0,'".$usr_pw."')"); | |
echo("Done"); | |
exit(); | |
} | |
else{ echo("userid : $q[id]<br><br>password : $q[pw]"); exit(); } | |
} | |
} | |
} | |
?> | |
<img id=logo onclick=this.width++ src=images/star.gif> | |
<form method=post action=index.php> | |
<input type=text name=id><input type=password name=pw><br> | |
<input type=submit name=cmd value='Login'> | |
<input type=submit name=cmd value='Register'> | |
</form> | |
<script> | |
setInterval("logo.src='images/mon'+(1+Math.floor(Math.random()*6))+'.gif'",500); | |
</script> | |
</body> | |
<!-- index.phps auth.phps --> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment