탈퇴
2004.02.28(토) 오전 04:50:00(221.164.xxx.xx)
int cmd(string arg)
{
mixed *dir;
string rdfile, *lines, col, xx, yy, file_name, file;
string tx, ty, text, msg, time, str, zone;
int i, sz, x, y=0, si, max_si;
if (!arg || sscanf(arg,"%s %s",str,zone) != 2)
return notify_fail("\n사용법 : <화일명> <디렉토리명> 지도변환\n\n");
rdfile = read_file("/text/map/"+str);
if( !rdfile )
return notify_fail("\n * /text/map 디렉토리에서 [ "+str+" ] 화일을 찾을 수 없습니다.\n\n");
dir = get_dir("/d/"+zone);
if( sizeof(dir) )
return notify_fail("\n * 이미 /d/"+zone+" 디렉토리가 존재 합니다.\n\n");
lines = explode(rdfile,"\n");
sz = sizeof(lines);
if(!sz) return notify_fail("\n * 화일 내용 없음\n\n");
mkdirs( "/d/"+zone+"/" );
time = ctime(time());
for( i = 0; i < sz ; i++) {
col = lines[i];
si = sizeof(col);
while( si-- ) {
if( col[si] == 32 ) col = col[0..si-1];
else break;
}
si = sizeof(col);
for( x = 0; x < si ; x++ ) {
text = "";
if( col[x] != 161 ) {
continue;
}
else if( col[x..x+1] == "○" ||
col[x..x+1] == "■" ) {
if( (x/4+1)<10 ) xx = "0"+(x/4+1);
else xx = ""+(x/4+1);
if( (i/2+1)<10 ) yy = "0"+(i/2+1);
else yy = ""+(i/2+1);
file_name = xx+yy+".c";
file = xx+yy+"";
if( x+2 < si ) {
if( col[x+2..x+3] == "─" ) {
if( (x/4+2)<10 ) tx = "0"+(x/4+2);
else tx = ""+(x/4+2);
text += "\t\"동\" : \"/d/"+zone+"/"+tx+yy+"\",\n";
}
else if( col[x-2..x-1] == "↔" ) {
if( (x/4+2)<10 ) tx = "0"+(x/4+2);
else tx = ""+(x/4+2);
text += "\t\"계단\" : \"/d/"+zone+"/"+tx+yy+"\",\n";
}
}
if( (x/4+1) > 1 ) {
if( col[x-2..x-1] == "─" ) {
if( (x/4)<10 ) tx = "0"+(x/4);
else tx = ""+(x/4);
text += "\t\"서\" : \"/d/"+zone+"/"+tx+yy+"\",\n";
}
else if( col[x-2..x-1] == "↔" ) {
if( (x/4)<10 ) tx = "0"+(x/4);
else tx = ""+(x/4);
text += "\t\"계단\" : \"/d/"+zone+"/"+tx+yy+"\",\n";
}
}
if( i+1 < sz ) {
if( lines[i+1][x..x+1] == "│" ) {
if( (i/2+2)<10 ) ty = "0"+(i/2+2);
else ty = ""+(i/2+2);
text += "\t\"남\" : \"/d/"+zone+"/"+xx+ty+"\",\n";
}
else if( lines[i+1][x..x+1] == "↕" ) {
if( (i/2+2)<10 ) ty = "0"+(i/2+2);
else ty = ""+(i/2+2);
text += "\t\"계단\" : \"/d/"+zone+"/"+xx+ty+"\",\n";
}
if( lines[i+1][x-2..x-1] == "/" ) {
if( (i/2+2)<10 ) ty = "0"+(i/2+2);
else ty = ""+(i/2+2);
if( (x/4+2)<10 ) tx = "0"+(x/4);
else tx = ""+(x/4);
text += "\t\"남서\" : \"/d/"+zone+"/"+tx+ty+"\",\n";
}
if( lines[i+1][x+2..x+3] == "\" ) {
if( (i/2+2)<10 ) ty = "0"+(i/2+2);
else ty = ""+(i/2+2);
if( (x/4+2)<10 ) tx = "0"+(x/4+2);
else tx = ""+(x/4+2);
text += "\t\"남동\" : \"/d/"+zone+"/"+tx+ty+"\",\n";
}
}
if( (i/2+1) > 1 ) {
if( lines[i-1][x..x+1] == "│" ) {
if( (i/2)<10 ) ty = "0"+(i/2);
else ty = ""+(i/2);
text += "\t\"북\" : \"/d/"+zone+"/"+xx+ty+"\",\n";
}
else if( lines[i-1][x..x+1] == "↕" ) {
if( (i/2)<10 ) ty = "0"+(i/2);
else ty = ""+(i/2);
text += "\t\"계단\" : \"/d/"+zone+"/"+xx+ty+"\",\n";
}
if( x+2 < si ) {
if( lines[i-1][x+2..x+3] == "/" ) {
if( (i/2)<10 ) ty = "0"+(i/2);
else ty = ""+(i/2);
if( (x/4+2)<10 ) tx = "0"+(x/4+2);
else tx = ""+(x/4+2);
text += "\t\"북동\" : \"/d/"+zone+"/"+tx+ty+"\",\n";
}
}
if( lines[i-1][x-2..x-1] == "\" ) {
if( (i/2)<10 ) ty = "0"+(i/2);
else ty = ""+(i/2);
if( (x/4)<10 ) tx = "0"+(x/4);
else tx = ""+(x/4);
text += "\t\"북서\" : \"/d/"+zone+"/"+tx+ty+"\",\n";
}
}
y++;
if( col[x..x+1] == "■" )
msg = HEAD+PLAG+TEXT+text+"\t])) ;\n"+LAST+"\n";
else
msg = HEAD+TEXT+text+"\t])) ;\n"+LAST+"\n";
save_file("/d/"+zone+"/"+file_name,msg);
continue;
}
}
if( max_si < si ) max_si = si;
}
write("\n * 존 크기 : "+(max_si/4+1)+" × "+(sz/2+1)+", 총 "+y+"개의 룸이 완성되었습니다.\n\n");
return 1;
}
소스는 이거요~