function setuser(setuser1,setvalue){  //userdata操作
sz_user.setAttribute(setuser1,setvalue)}
function getuser(getuser1){  //userdata操作
var tempc=sz_user.getAttribute(getuser1);if(tempc==null)return null;
if(isNaN(parseInt(tempc))==true){  //字符
return tempc}else{  //is数字
return parseFloat(tempc)
}}
function saveuser(wannengcunqu){  //存
if(sz_selcundian.selectedIndex==10&&wannengcunqu==null)return;sz_user.load("shenshuo2013_"+sz_selcundian.selectedIndex);
setuser("banben","shenshuo2013原创:风云舞");setuser("fei",yd.zt);setuser("yd",rpg.yd);setuser("yd2",rpg.yd2);
setuser("mingwang",rpg.mingwang);setuser("yuanling",rpg.yuanling);
setuser("glod",rpg.glod);setuser("hj",rpg.hj);setuser("qingshang",rpg.qingshang)
setuser("usedian",rpg.usedian);setuser("gametime",rpg.gametime);
setuser("cunkuan",rpg.cunkuan);setuser("zhuanzhi",rpg.zhuanzhi);
setuser("dian",rpg.dian);setuser("wp",rpg.wp);setuser("zb",rpg.zb);setuser("jn",rpg.jn);
setuser("sjdt",rpg.sjdt);setuser("zy",rpg.zy);setuser("kill",rpg.kill);setuser("dropwp",rpg.dropwp);
setuser("ck",rpg.ck);setuser("rw",rpg.rw);setuser("cg",rpg.cg);setuser("luck",rpg.luck)
setuser("dtwenjian",dtwenjian);setuser("dtname",dtname);setuser("mex",mex);setuser("mey",mey);
setuser("huanyuantime",huanyuantime);setuser("date",new Date())
setuser("wenxian",rpg.wenxian);setuser("ckshangxian",rpg.ckshangxian);setuser("ciyuan",rpg.ciyuan);
setuser("gh_name",gh.name);setuser("gh_renshu",gh.renshu);setuser("gh_zichan",gh.zichan);
setuser("gh_zhimingdu",gh.zhimingdu);setuser("gh_time",gh.time);setuser("gh_jianjie",gh.jianjie);
setuser("gh_mengjun",gh.mengjun);setuser("gh_chengbao",gh.chengbao);
setuser("allkilllen",rpg.allkilllen);
setuser("fuhuoshu",rpg.fuhuoshu);setuser("cykillnoboss",rpg.cykillnoboss);setuser("cykillboss",rpg.cykillboss);
setuser("ghmeleft",rpg.ghmeleft);setuser("zuobi",rpg.zuobi);

for(var i=0;i<wj.length;i++){
for(var r=0;r<wjshuxing.length;r++){
eval("setuser('wj"+i+"_'+wjshuxing[r],wj[i]."+wjshuxing[r]+")")
}}

if(wannengcunqu!=null)return sz_user.XMLDocument.documentElement.xml  //为万能读取返回数据
sz_user.save("shenshuo2013_"+sz_selcundian.selectedIndex);
if(fm_shezhi.style.display!="none"&&sz_user.style.display!="none")tbfun.shezhi();
}
function loaduser(evobj){  //读
for(var i=0;i<sz_usertd.length;i++){if(sz_usertd[i]==evobj)break;}
sz_user.load("shenshuo2013_"+i);if(getuser("banben")==null)return gdtext(event.x,event.y,"无法读取,档案为空或不正确")
if(!confirm("要读取该游戏记录存档,将立即中止目前的游戏进度,你确定吗?"))return;
tbfun._close();
rpg.kill=getuser("kill").split(",");
if(rpg.kill.length!=gwdom.getElementsByTagName("document")[0].childNodes.length){  //游戏进行中更新了怪物xml，影响排序，这里要更新一下
var oldkill=rpg.kill.slice(0);shouce.killload();
for(var t=0;t<rpg.kill.length;t++){var temname=rpg.kill[t].split("=")[0]
for(var r=0;r<oldkill.length;r++){
if(oldkill[r].split("=")[0]==temname){rpg.kill[t]=temname+"="+oldkill[r].split("=")[1];break;}
}}
}
sz_selcundian.selectedIndex=i;

var tempcg1=getuser("cg").split(",");if(rpg.cg.length!=tempcg1.length){  //游戏进行中更新了CG，影响排序，这里要更新一下
for(var i=0;i<rpg.cg.length;i++){
for(var r=0;r<tempcg1.length;r++){
if(rpg.cg[i].split("=")[0]==tempcg1[r].split("=")[0])rpg.cg[i]=tempcg1[r]
}}
}else{rpg.cg=tempcg1;}
rpg.wp=getuser("wp").split(",");rpg.zb=getuser("zb").split(",");rpg.jn=getuser("jn").split(",");
rpg.sjdt=getuser("sjdt").split(",");rpg.zy=getuser("zy").split(",");
rpg.dropwp=getuser("dropwp").split(",");rpg.ck=getuser("ck").split(",");rpg.rw=getuser("rw").split(",");

function tempfun(rpgs){for(var i=0;i<rpgs.length;i++){if(rpgs[i]=="")rpgs[i]=null}}
tempfun(rpg.wp);tempfun(rpg.jn);tempfun(rpg.sjdt);tempfun(rpg.zy);tempfun(rpg.kill);tempfun(rpg.dropwp);
tempfun(rpg.ck);tempfun(rpg.zb);tempfun(rpg.rw);

wj[0].lv=99999;
for(var i=0;i<zbtd.length;i++){if(rpg.zb[i]==null){zbtd[i].innerHTML="";continue;}
wpzb.zbadd(rpg.zb[i])}

for(var i=0;i<wj.length;i++){
for(var r=0;r<wjshuxing.length;r++){
eval("wj[i]."+wjshuxing[r]+"=getuser('wj"+i+"_"+wjshuxing[r]+"')")
}}
sz[1].innerText=wj[0].name;rpg.yd=getuser("yd");rpg.yd2=getuser("yd2");rpg.ckshangxian=getuser("ckshangxian")
rpg.mingwang=getuser("mingwang");rpg.yuanling=getuser("yuanling");rpg.luck=getuser("luck")
rpg.glod=getuser("glod");rpg.hj=getuser("hj");rpg.qingshang=getuser("qingshang")
rpg.usedian=getuser("usedian");rpg.gametime=getuser("gametime");rpg.cunkuan=getuser("cunkuan");
rpg.zhuanzhi=sz_user.getAttribute("zhuanzhi");rpg.wenxian=sz_user.getAttribute("wenxian");rpg.ciyuan=getuser("ciyuan");
gh.name=getuser("gh_name");gh.renshu=getuser("gh_renshu");gh.zichan=getuser("gh_zichan");
gh.zhimingdu=getuser("gh_zhimingdu");gh.time=getuser("gh_time");gh.jianjie=getuser("gh_jianjie");
gh.mengjun=getuser("gh_mengjun");gh.chengbao=getuser("gh_chengbao");
rpg.fuhuoshu=getuser("fuhuoshu");rpg.cykillnoboss=getuser("cykillnoboss");rpg.cykillboss=getuser("cykillboss");
rpg.allkilllen=getuser("allkilllen");rpg.ghmeleft=getuser("ghmeleft");
rpg.zuobi=getuser("zuobi");if(rpg.zuobi!=0)zuobiimg.style.display="";

yuantouxiang.src=wj[0].xingbie=="男性"?"img/touxiang/3.gif":"img/touxiang/4.gif";
var alldian=sz_user.getAttribute("dian").split(",");  //这里必须这样,否则就被parseInt滤掉了
for(var i=0;i<alldian.length;i++){rpg.dian[i]=parseInt(alldian[i])}

xml.loaddt(getuser("dtwenjian"),getuser("dtname"),getuser("mex"),getuser("mey"));
huanyuantime=getuser("huanyuantime");

fm1.style.left=fmleft;fm1.style.top=fmtop;me.style.left=mex;me.style.top=mey;
me2.style.left=mex;me2.style.top=mey;me3.style.left=mex;me3.style.top=mey;
yd.guijiyoubiao2=0;yd.guijiyoubiao=0
yd.ying();wjjs.shuaxin()
gx_rpg();
sd_sd=false;sd_kuang.style.display="none";sl.suoding=false;sl_kuang.style.visibility="hidden";
jn_kuang.style.display="none",lvupdiv.style.display="none",zt_kuang.style.display="none"
wp_kuang.style.display="none";dh.close();if(yd.zt!=getuser("fei"))tbfun.feixing();yd.zt=getuser("fei");
if(yd.zt=="潜泳")yd.zt="走路";lt.help("目前位于"+rpg.ciyuan+"次元("+rpg.ciyuan+"周目)的游戏世界");
for(var i=0;i<ztimg.length;i++){me.szt[i]="";clearInterval(ztimg[i].go);ztimg[i].style.display="none";}  //清除状态

}
var tbfun={lr:true,pi:Math.PI,
begin:function(){
var pishu=tb.length,zhou=45,x=mewid/2+fmleft+mex-20;y=mehei/2+fmtop+mey-15
for(var i=0;i<pishu;i++){
if(tbfun.lr){tb[i].ci=0;tb[i].jiao=360/pishu*i;tb[i].style.width=30;tb[i].style.height=30;tb[i].style.display="block";}
else{jiao=tb[i].jiao;x=tb[i].offsetLeft;y=tb[i].offsetTop}
if(tb[i].go!=null){clearInterval(tb[i].go);tb[i].go=null}
tbfun.add(i,x,y,tb[i].jiao,zhou)
}tbfun.lr=!tbfun.lr
},
add:function(num,x,y,jiao,zhou){
tb[num].go=setInterval(function(){tbfun.show(tb[num],x+(zhou*Math.cos(jiao*tbfun.pi/180)),y+(zhou*Math.sin(jiao*tbfun.pi/180)),zhou)},25)
},
show:function(obj,x,y,zhou){
var max=18;if(tbfun.lr)max=36;
if(obj.ci++>max){clearInterval(obj.go);obj.go=null;return obj.style.display=tbfun.lr?"none":"block";}obj.jiao+=10
obj.style.left=x-(zhou*Math.cos(obj.jiao*tbfun.pi/180));obj.style.top=y-(zhou*Math.sin(obj.jiao*tbfun.pi/180))
},

over:function(obj){
if(obj.go!=null)return;obj.style.width=50;obj.style.height=50
obj.style.left=obj.offsetLeft-10;obj.style.top=obj.offsetTop-10
for(var i=0;i<tb.length;i++){if(tb[i]==obj)break;}
switch(i){
case 0:showtmk('状态/加点/职业培养');break;
case 1:showtmk('物品与装备');break;
case 2:showtmk('1:本游戏为近3D引擎,地图搭建有高度和障碍的判断<br>2:飞行状态下,能跨越较低障碍和海洋,但能被高空障碍拦截<br>3:走路能从高空障碍的下面穿越,也能在海洋中游泳潜水<br>4:同时存在高空/陆地/水中概念,甚至存在陷阱地形如迷宫地图<br>5:踏入陷阱域会受到各种损害,这时最好迅速远离或立即切换移动方式',"起飞与降落","red");break;
case 3:showtmk('用黄金交易金币/买卖神奇物品装备','黑市','red');break;
case 4:showtmk('发展/建设你自己的公会,等今后你有了公会即可使用','公会事务','red');break;
case 5:showtmk('存档读档/游戏设置/关于版权','设置','red');break;
case 6:showtmk('含怪物手册/游戏数据/文献记载/CG回忆等全功能成就框','成就图鉴','red');break;
case 7:showtmk('技能与魔法');break;
}
obj.onmouseout=function(){if(obj.go!=null||obj.offsetWidth!=50)return;obj.style.width=30;obj.style.height=30
obj.style.left=obj.offsetLeft+10;obj.style.top=obj.offsetTop+10;tmk1.style.visibility='hidden'}
},

feixing:function(){  //飞
if(yd.zt!="飞行"&&rpg.zb[14]==null)return lt.help("您没有装备飞行器")
if(xml.fei=="禁止"&&yd.zt!="飞行")return lt.help("此地图禁飞")
yd.zt!="飞行"?yd.zt="飞行":yd.zt="走路";
if(yd.zt=="飞行"){
me.style.backgroundImage="url('img/xingzou/rpg1_fei1.gif')";me2.style.backgroundImage=me.style.backgroundImage
rpg.yd2=parseInt(xml.getwp("zb",rpg.zb[14]).getAttribute("飞行速度"));
shezhifei.src="img/ico/fei.gif";shezhifei.style.visibility="visible";
ying.style.width=30;ying.style.height=15;ying.style.marginTop=10
me.style.zIndex=50;yinxiao("起飞");me.style.height=95;me2.style.height=95;ying.style.visibility="visible"
}else{
rpg.yd2=0;me.style.backgroundImage="url('img/xingzou/rpg1.gif')"
shezhifei.style.visibility="hidden";ying.style.width=80;ying.style.height=30;ying.style.marginTop=0
me.style.zIndex=5;yinxiao("降落");me2.style.backgroundImage="url('img/xingzou/rpg2.gif')";
}yd.ying();xunlu.jisuan(mex,mey,0,0);me.focus();if(zt_kuang.style.display!="none")tbzt.zhuangtai();
},
shezhi:function(){  //系统设置
sz_gamename.innerText=xml.getpz("关于","游戏名称")+"-"+xml.getpz("关于","本版名称");
shezhibiaoti[0].innerText=xml.getpz("关于","游戏名称")+"-"+xml.getpz("关于","本版名称");
shezhibiaoti[1].innerText=xml.getpz("关于","最终更新")
shezhibiaoti[2].innerText=xml.getpz("关于","原作者")
shezhijianjie.innerText=xml.getpz("关于","游戏简介")
try{sz_genlujing.innerText=location.pathname.replace(/\/(\w+)/,"$1");}catch(e){}
for(var i=3;i<shezhibiaoti.length;i++)shezhibiaoti[i].innerText=xml.getpz("关于","原作者")
for(var i=0;i<sz_usertd.length;i++){
sz_user.load("shenshuo2013_"+i);if(getuser("wj0_name")==null){sz_usertd[i].innerHTML="<font style='font-weight:bold;'>"+(i+1)+"号存储点,记忆空白</font>";continue;}
var newd=new Date(getuser("date"))
var newdate1=newd.getHours()+":"+newd.getMinutes()+":"+newd.getSeconds()+"-<font style='color:gray'>"+newd.getYear()+"."+(newd.getMonth()+1)+"."+newd.getDate()+"</font>"

var temfei=getuser("fei")=="飞行"?"rpg1_fei1_up1":"rpg1_up1";
var ciyuanmoshi=getuser("ciyuan")==1?"<img src='img/ico/moshi1.gif' style='margin-left:-68;margin-top:35' onmousemove='showtmk(\"该存档正在进行1周目普通游戏难度模式\",\"1次元难度=100%\",\"red\");'>":"<img src='img/ico/moshi2.gif' style='margin-left:-68;margin-top:35' onmousemove='showtmk(\"该存档正在进行"+getuser("ciyuan")+"次元游戏难度模式\",\""+getuser("ciyuan")+"次元难度="+(100+((getuser("ciyuan")-1)*50))+"%\",\"red\");'>";
sz_usertd[i].innerHTML="<img src='img/xingzou/"+temfei+".gif' style='position:static;width:60;height:70;' align=left onmousemove='showtmk(\"角色形象,今后将与职业/转职/性别关联上,暂时先统一形象\")'>"+ciyuanmoshi+"<font style='font-weight:bold;'>"+(i+1)+"#</font> <font style='color:purple;font-weight:bold;'><img style='position:static;' src='img/ico/zt.gif' width=15><font style='color:red'>"+getuser("wj0_lv")+"/"+getuser("wj0_lv2")+"</font> "+getuser("wj0_name")+" <img src='img/ico/sjdt_in.gif' style='position:static;'>"+getuser("dtname")+"</font> <img src='img/biaoqing/em0.gif' style='position:static;' onmousemove='showtmk(\"本角色合计爽歪歪的游戏时间~-~\")'>"+round(getuser('gametime')/60/60)+"小时 <br><img width=20 src='img/ico/hp.gif' style='position:static;'><font color=red>"+getuser("wj0_hp1")+"/"+getuser("wj0_hp2")+"</font> <img width=20 src='img/ico/mp.gif' style='position:static;'><font color=blue>"+getuser("wj0_mp1")+"/"+getuser("wj0_mp2")+"</font> <img style='position:static;' width=20 src='img/ico/gold.gif'><font color=red>"+getuser("glod")+"</font> <img style='position:static;' width=20 src='img/ico/exp.gif'><font color=purple>"+new String(getuser("wj0_exp1")/(getuser("wj0_exp2")/100)).substr(0,5)+"%</font><br>"
var temparr=[];for(var r=1;r<wj.length;r++){if(getuser("wj"+r+"_name")=="")continue;
temparr[r]="<img src='"+getuser("wj"+r+"_src")+"' width=20 height=20 style='position:static;'>"
}
sz_usertd[i].innerHTML+=temparr.join("")+"<img height=20 style='position:static;' src='img/ico/time.gif' onmousemove='showtmk(\"游戏数据自动存储时的时间\")'>"+newdate1

}
fm_shezhi.style.display="";fm_shezhi.style.left=bodywid/2-(fm_shezhi.offsetWidth/2);
fm_shezhi.style.top=bodyhei/2-(fm_shezhi.offsetHeight/2);tbfun.begin()
},
showzuozhe:function(thesrc){  //制作群人员大图像预览
zzdaimg.src=thesrc;if(zzdaimg.go!=null){clearTimeout(zzdaimg.go);zzdaimg.go=null;}
zzdaimg.go=setTimeout(function(){
zzdaimg.style.left=(bodywid-zzdaimg.offsetWidth)/2;zzdaimg.style.top=(bodyhei-zzdaimg.offsetHeight)/2;
zzdaimg.style.visibility='visible'
},50)
},
dropzindex:3,dropobj:null,  //物件拖动
_dropdown:function(obj,obj2){
if(event.button!=0){obj.oldx=event.offsetX+event.srcElement.offsetLeft;obj.oldy=event.offsetY-event.srcElement.scrollTop;
if(tbfun.dropobj!=obj){obj.style.zIndex+=tbfun.dropzindex;tbfun.dropobj=obj}
obj2.setCapture();}
},
_dropmove:function(obj){
try{
if(event.button!=0){obj.style.left=event.x-obj.oldx;obj.style.top=event.y-obj.oldy}
if(obj.offsetLeft>bodywid-obj.offsetWidth)obj.style.left=bodywid-obj.offsetWidth
if(obj.offsetTop>bodyhei-obj.offsetHeight)obj.style.top=bodyhei-obj.offsetHeight
if(obj.offsetLeft<0)obj.style.left=0
if(obj.offsetTop<0)obj.style.top=0
}catch(e){}
},
_dropup:function(obj){if(event.button!=0){obj.releaseCapture();}},

allhtm:null,_zhizuoqun:function(){  //制作群
bqkongzhi.options[2].selected=true;bqkongzhi.value=1;
yinxiao("制作群");fm_shezhi.style.display="none";zhizuoqun2.scrollTop=0;zhizuoqun1.style.display="";
zhizuoqun3.style.left=zhizuoqun1.offsetWidth-90;zhizuoqun4.style.left=zhizuoqun3.offsetLeft;
zhizuoqun5.style.left=zhizuoqun3.offsetLeft;zhizuoqun6.style.left=zhizuoqun3.offsetLeft;
zhizuoqun7.style.left=zhizuoqun3.offsetLeft;zhizuoqun8.style.left=zhizuoqun3.offsetLeft;
if(zhizuoqun2.go!=null){clearInterval(zhizuoqun2.go);clearInterval(bqdaima.go);zhizuoqun2.go=null;bqdaima.go=null;bqdaima.innerText=""}
zhizuoqun2.go=setInterval(function(){zhizuoqun2.scrollTop+=parseInt(bqkongzhi.value)},40)
tbfun.allhtm=(sjdtdom.xml+jndom.xml+rwdom.xml+document.all[0].outerHTML+dtdom.xml+wpdom.xml+gwdom.xml+jqdom.xml+zbdom.xml).split("\n");
bqdaima.line=0;bqdaima.max=tbfun.allhtm.length;bqdaima.zishu=0;
bqdaima.go=setInterval(function(){
if(bqdaima.line++>bqdaima.max){clearInterval(bqdaima.go);bqdaima.go=null}else{
var txt1=[]
for(var i=bqdaima.line-65;i<bqdaima.line;i++){
if(i<0)i=0;txt1[i]=tbfun.allhtm[i]
}
txt1=txt1.join("");try{bqdaima.zishu+=tbfun.allhtm[i].length}catch(e){}
bqdaima.innerText=txt1;bqdaima.scrollTop=bqdaima.scrollHeight
bqdaimashu.innerText="HTML游戏编程演示 "+(bqdaima.line-1)+"-"+bqdaima.max+" 行,"+bqdaima.zishu+" 字"
}},35);
},
_close:function(){  //确定+取消
fm_shezhi.style.display="none";
}
}