Skip to content

Instantly share code, notes, and snippets.

@laechan
Created September 27, 2021 02:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laechan/d5ffd26215017878df2eac34d74bcc07 to your computer and use it in GitHub Desktop.
Save laechan/d5ffd26215017878df2eac34d74bcc07 to your computer and use it in GitHub Desktop.
confarea.htm
<html>
<Meta Http-Equiv="Content-Type" Content="text/html; Charset=utf-8">
<body bgcolor="#93ED93">
<pre id=area_longc style='display:none'>
// room_long.c 樣本, 需與 long.h 搭配
#include "area_long.h"
string query_long()
{
int r1,r2,r3;
string tmp,msg;
r1=random(sizeof(MSG1));
r2=random(sizeof(MSG2));
r3=random(sizeof(MSG3));
tmp=MSG1[r1]+","+MSG2[r2]+","+MSG3[r3];
random(2)==1 ? tmp+="。" : tmp+="!";
r2=strlen(tmp);
msg="";
for(r1=0;r1<r2;r1=r1+56)
r1+55 >= r2-1 ? msg+=tmp[r1..r2-1]+"\n" : msg+=tmp[r1..r1+55]+"\n";
return msg+"\n";
}
</pre>
<pre id=area_longh style='display:none'>
#include "/data/area/這裡要改/long1.h"
#include "/data/area/這裡要改/long2.h"
#include "/data/area/這裡要改/long3.h"
#define MSG1 LONG_MSG1
#define MSG2 LONG_MSG2
#define MSG3 LONG_MSG3
</pre>
<pre id=vobjs style="display:none">
m001 哀唱草 laechan 把 怪掉落 99 288
m002 腐臭花 laechan 朵 怪掉落 99 325
m003 鱗片 laechan 塊 怪掉落 99 409
m004 牙齒 laechan 顆 怪掉落 99 238
m005 尾巴 laechan 條 怪掉落 99 409
m006 鳥嘴 laechan 個 怪掉落 99 338
m007 翅膀 laechan 雙 怪掉落 99 412
m008 犄角 laechan 支 怪掉落 99 226
m009 魔物心臟 laechan 顆 怪掉落 99 275
m010 魔物碎片 laechan 塊 怪掉落 99 320
m011 龍鱗 laechan 片 怪掉落 99 214
m012 龍爪 laechan 只 怪掉落 99 374
m013 龍牙 laechan 顆 怪掉落 99 303
m014 龍皮 laechan 塊 怪掉落 99 243
m015 龍尾 laechan 條 怪掉落 99 287
m016 龍角 laechan 支 怪掉落 99 334
m017 硬角 laechan 支 怪掉落 99 324
m018 外皮 laechan 塊 怪掉落 99 259
m019 毛皮 laechan 塊 怪掉落 99 375
m020 硬皮 laechan 塊 怪掉落 99 351
m021 黏蹼 laechan 個 怪掉落 99 339
m022 鐵蹄 laechan 塊 怪掉落 99 242
m023 硬蹄 laechan 塊 怪掉落 99 416
m024 獸掌 laechan 只 怪掉落 99 282
m025 外殼 laechan 片 怪掉落 99 328
m026 硬殼 laechan 片 怪掉落 99 284
m027 柔毛 laechan 塊 怪掉落 99 383
m028 尖刺 laechan 根 怪掉落 99 295
m029 觸角 laechan 支 怪掉落 99 188
m030 觸手 laechan 條 怪掉落 99 423
m031 繃帶 laechan 片 怪掉落 99 256
m032 鼻環 laechan 個 怪掉落 99 338
m033 背鰭 laechan 塊 怪掉落 99 399
m034 魚鱗 laechan 片 怪掉落 99 205
m035 鰓刺 laechan 塊 怪掉落 99 406
m036 魚尾 laechan 條 怪掉落 99 298
m037 大鉗 laechan 支 怪掉落 99 321
m038 大螯 laechan 支 怪掉落 99 214
m039 蜘蛛絲 laechan 團 怪掉落 99 263
m040 羽毛 laechan 片 怪掉落 99 272
m041 木頭 laechan 根 怪掉落 99 194
m042 枯枝 laechan 根 怪掉落 99 367
m043 樹根 laechan 塊 怪掉落 99 338
m044 葉子 laechan 片 怪掉落 99 219
m045 樹皮 laechan 片 怪掉落 99 207
m046 芽苗 laechan 株 怪掉落 99 212
m047 芽孢 laechan 顆 怪掉落 99 336
m048 植物梗 laechan 個 怪掉落 99 435
m049 藤蔓 laechan 條 怪掉落 99 235
m050 仙人掌刺 laechan 根 怪掉落 99 218
m051 蛋殼 laechan 片 怪掉落 99 407
m052 蜂針 laechan 根 怪掉落 99 319
m053 腐肉 laechan 塊 怪掉落 99 306
m054 昆蟲下巴 laechan 個 怪掉落 99 309
m055 昆蟲後腿 laechan 條 怪掉落 99 261
m056 怪物指甲 laechan 片 怪掉落 99 419
m057 怪物舌頭 laechan 條 怪掉落 99 352
m058 亡者遺骨 laechan 根 怪掉落 99 324
m059 怪物骨頭 laechan 根 怪掉落 99 260
m060 魔物頭骨 laechan 片 怪掉落 99 383
m061 冰粒 laechan 塊 怪掉落 99 505
m062 泥團 laechan 沱 怪掉落 99 422
m063 炙毛 laechan 塊 怪掉落 99 276
m064 緞布 laechan 條 怪掉落 99 286
m065 粉末 laechan 沱 怪掉落 99 230
m066 燐粉 laechan 沱 怪掉落 99 368
m067 辮子 laechan 條 怪掉落 99 203
m068 符紙 laechan 張 怪掉落 99 392
m069 菌絲 laechan 沱 怪掉落 99 247
m070 黏液 laechan 沱 怪掉落 99 395
m071 螺絲 laechan 顆 怪掉落 99 428
m072 螺栓 laechan 根 怪掉落 99 313
m073 螺帽 laechan 顆 怪掉落 99 282
m074 鏽鐵 laechan 塊 怪掉落 99 258
m075 鉚釘 laechan 支 怪掉落 99 290
m076 彈簧 laechan 條 怪掉落 99 371
m077 墊片 laechan 塊 怪掉落 99 316
m078 墊圈 laechan 個 怪掉落 99 373
m079 承軸 laechan 根 怪掉落 99 449
m080 扣環 laechan 個 怪掉落 99 324
m081 斷掉的武器 laechan 把 怪掉落 99 399
m082 破裂的防具 laechan 件 怪掉落 99 299
m083 獸人頭角 laechan 只 怪掉落 99 430
m084 獸人毛皮 laechan 塊 怪掉落 99 352
m085 魔物手掌 laechan 隻 怪掉落 99 362
m086 虎牙 norr 顆 怪掉落 99 213
m087 虎皮 norr 塊 怪掉落 99 225
m088 虎鞭 norr 條 怪掉落 99 312
m089 狼牙 norr 顆 怪掉落 99 163
m090 狼皮 norr 塊 怪掉落 99 153
m091 毒囊 norr 個 怪掉落 99 333
m092 猴皮 norr 塊 怪掉落 99 213
m093 猴尾 norr 條 怪掉落 99 248
m094 猿掌 norr 個 怪掉落 99 312
m095 黑鼠皮 laechan 張 怪掉落 99 777
m096 蟲卵 laechan 沱 怪掉落 99 222
m097 吸盤 laechan 個 怪掉落 99 311
m098 魚精 laechan 沱 怪掉落 99 365
m099 石心 laechan 顆 怪掉落 99 473
m100 魚皮 laechan 張 怪掉落 99 354
m101 銀針 laechan 根 怪掉落 99 543
m102 手銬 laechan 付 怪掉落 99 845
m103 腳鐐 laechan 付 怪掉落 99 924
m201 炙蟻酸液 laechan 份 藥材類 99 1500
m202 蛇精之血 laechan 份 藥材類 99 1500
m203 魔法骨灰 laechan 包 藥材類 99 1500
m204 魔法燐粉 laechan 包 藥材類 99 1500
m205 雙尖咧齒 laechan 顆 藥材類 99 1500
m206 飛鼬之尾 laechan 條 藥材類 99 1500
m207 龍之血液 laechan 滴 藥材類 99 1500
m208 龍之骨髓 laechan 根 藥材類 99 1500
m209 深海魚油 laechan 顆 藥材類 99 1500
m210 怨念之心 laechan 顆 藥材類 99 1500
m211 惡魔眼球 laechan 顆 藥材類 99 1500
m212 麒麟之角 laechan 只 藥材類 99 1500
m213 劇毒之疣 laechan 顆 藥材類 99 1500
m214 魔法花液 laechan 滴 藥材類 99 1500
m301 神之金屬 laechan 顆 鑄材類 99 5000
m302 星星粉末 laechan 袋 鑄材類 99 5000
m801 紅色晶礦 laechan 顆 怪掉落 99 300
m802 藍色晶礦 laechan 顆 怪掉落 99 300
m803 綠色晶礦 laechan 顆 怪掉落 99 300
m804 黃色晶礦 laechan 顆 怪掉落 99 300
m805 紫色晶礦 laechan 顆 怪掉落 99 300
m806 靛色晶礦 laechan 顆 怪掉落 99 300
m807 黑色晶礦 laechan 顆 怪掉落 99 300
m808 白色晶礦 laechan 顆 怪掉落 99 300
m811 紅寶石 laechan 顆 怪掉落 99 1000
m812 黃寶石 laechan 顆 怪掉落 99 1000
m813 綠寶石 laechan 顆 怪掉落 99 1000
m814 藍寶石 laechan 顆 怪掉落 99 1000
m815 紫寶石 laechan 顆 怪掉落 99 1000
m816 白寶石 laechan 顆 怪掉落 99 1000
m821 火靈礦石 laechan 顆 怪掉落 99 500
m822 水靈礦石 laechan 顆 怪掉落 99 500
m823 風靈礦石 laechan 顆 怪掉落 99 500
m824 雷靈礦石 laechan 顆 怪掉落 99 500
m825 土靈礦石 laechan 顆 怪掉落 99 500
m826 火靈原石 laechan 顆 怪掉落 99 500
m827 水靈原石 laechan 顆 怪掉落 99 500
m828 風靈原石 laechan 顆 怪掉落 99 500
m829 雷靈原石 laechan 顆 怪掉落 99 500
m830 土靈原石 laechan 顆 怪掉落 99 500
m831 黑色染料 laechan 瓶 怪掉落 99 1000
m832 紅色染料 laechan 瓶 怪掉落 99 1000
m833 綠色染料 laechan 瓶 怪掉落 99 1000
m834 黃色染料 laechan 瓶 怪掉落 99 1000
m835 藍色染料 laechan 瓶 怪掉落 99 1000
m836 紫色染料 laechan 瓶 怪掉落 99 1000
m837 靛色染料 laechan 瓶 怪掉落 99 1000
m838 白色染料 laechan 瓶 怪掉落 99 1000
m839 透明染料 laechan 瓶 怪掉落 99 1000
m841 火燄玫瑰 laechan 朵 怪掉落 99 2500
m842 冰雕玫瑰 laechan 朵 怪掉落 99 2500
m843 風城玫瑰 laechan 朵 怪掉落 99 2500
m844 閃電玫瑰 laechan 朵 怪掉落 99 2500
m845 永恆玫瑰 laechan 朵 怪掉落 99 2500
m851 炎晶碎片 laechan 塊 怪掉落 99 500
m852 冰晶碎片 laechan 塊 怪掉落 99 500
m853 風晶碎片 laechan 塊 怪掉落 99 500
m854 雷晶碎片 laechan 塊 怪掉落 99 500
m855 地晶碎片 laechan 塊 怪掉落 99 500
m856 光晶碎片 laechan 塊 怪掉落 99 500
m991 迷迭香 laechan 袋 藥引類 99 10 不可 不可
m992 鼠尾草 laechan 袋 藥引類 99 10 不可 不可
m993 鳶尾根 laechan 袋 藥引類 99 10 不可 不可
m994 玫瑰瓣 laechan 袋 藥引類 99 10 不可 不可
m995 忍冬花 laechan 袋 藥引類 99 10 不可 不可
m996 蜈蚣籐 laechan 袋 藥引類 99 10 不可 不可
m997 赤桔梗 laechan 袋 藥引類 99 10 不可 不可
m998 魔羅果 laechan 袋 藥引類 99 10 不可 不可
</pre>
<pre id=area_room_part1 style="display:none">
// 房間樣本 by Laechan@Sanc in 2011/11/23
#include "area.h"
varargs void init(object ob)
{
int n,s,t,ss;
mixed tmps=({});
object mob;
string files,tmp,set_datas="";
if(!userp(this_player())) return ;
if(!ob)
ob=this_object();
seteuid(getuid(ob));
// 這樣就能允許 room_long 暫時的故障, 當 room_long 故障時
// 房間的 long 就會一直不存在, 等到 room_long 修好時房間馬
// 上就能套用新的結果
if(!ob->query("long"))
if(!catch(mob=find_object_or_load(__DIR__+"area_long")))
ob->set("long",mob->query_long());
tmp=ob->query("room_file");
n=atoi(tmp);
</pre>
<pre id=area_room_part2 style="display:none">
// 房間還有怪物在時就不執行生怪
if(present("MONSTER",this_object())) return ;
t=time();
// 還未到怪物重生時間時就不執行生怪
if(ob->query("reborn_times")>t) return ;
n=random(MAX_MOBS_IN_ROOM);
s=sizeof(MOBS_DATA);
if(random(2)==1)
{
while(n-->0)
{
tmps=MOBS_DATA[random(s)];
/*
if(tmps[0]=="mob1" && random(10)!=2)
{
n=n+1;
continue;
}
*/
// 若 tmps[0] 是怪物檔名型式,直接叫出該怪物的檔案
if(tmps[0][0..0]=="/")
{
if(file_exists(tmps[0]+".c"))
if(mob=clone_object(tmps[0]))
mob->move(ob);
continue;
}
ss=sizeof(tmps);
files=__DIR__+"mob/"+tmps[0]+".c";
if(!file_exists(files))
{
tmp=read_file(__DIR__+"script_"+tmps[0]);
if(ss>1)
tmp=substr(tmp," SET_LEVEL;\n"," set(\"level\","+tmps[1]+");\n");
if(ss>2)
{
tmp=substr(tmp," SET_ID;\n"," set(\"id\","+identify(tmps[2])+");\n");
tmp=substr(tmp," SET_LIVING_NAME;\n"," set_living_name("+identify(tmps[2][1])+");\n");
}
if(ss>3)
{
tmp=substr(tmp," SET_NAME;\n"," set_name("+identify(tmps[3])+");\n");
if(strsrch(tmp," SET_SHORT;\n")>0)
tmp=substr(tmp," SET_SHORT;\n"," set(\"short\",\""+tmps[3]+"("+tmps[2][0]+")\");\n");
}
if(ss>4)
tmp=substr(tmp," SET_ETHIC;\n"," set(\"ethic\","+tmps[4]+");\n");
if(ss>5)
tmp=substr(tmp," SET_WEALTH;\n"," set(\"wealth\","+tmps[5]+");\n");
if(ss>6 && tmps[6]!=1)
tmp=substr(tmp," SET_MEMBER;\n"," set(\"member\","+tmps[6]+");\n");
else
tmp=substr(tmp," SET_MEMBER;\n","");
if(ss>7 && sizeof(tmps[7])>0)
tmp=substr(tmp," SET_DROP_TYPES;\n"," set(\"drop_types\","+identify(tmps[7])+");\n");
else
tmp=substr(tmp," SET_DROP_TYPES;\n","");
if(ss>8)
{
n=sizeof(tmps[8]);
n=n/3;
for(s=0;s&lt;n;s++)
{
if(tmps[8][s*3]=="temp")
set_datas+=" set_temp(\""+tmps[8][s*3+1]+"\","+identify(tmps[8][s*3+2])+");\n";
else
set_datas+=" set(\""+tmps[8][s*3+1]+"\","+identify(tmps[8][s*3+2])+");\n";
}
tmp=substr(tmp," SET_OTHER_DATA;\n",set_datas);
}
write_file(files,tmp);
}
mob=clone_object(files);
mob->move(ob);
} // end while
} // endif
// 只要有跑迴圈就應該設
ob->set("reborn_times",t+MOB_REBORN_TIMES);
}
</pre>
<a href=https://sites.google.com/view/randomapv1 target=_blank>隨機地圖產生器</a><p>
<a id=top></a>
<a href=#map>map</a>&emsp;
<a href=#area_room>area_room.c</a>&emsp;
<a href=#areah>area.h</a>&emsp;
<a href=#long>long.h</a><p>
<a id=area_room></a>
<table>
<tr><td colspan=6>D:\mud\area_room.c&emsp;<input type=button value='讀取' onclick='area_room_read()'>&ensp;
<input type=button value='存檔' onclick='area_room_save()'></td></tr>
<tr>
<td><textarea id=area_room1 style='font-size:14px;background-color:#93ED93;' cols=55 rows=29></textarea></td>
<td><textarea id=area_room2 style='font-size:14px;background-color:#93ED93;' cols=55 rows=29></textarea></td>
<td><textarea id=area_room3 style='font-size:14px;background-color:#93ED93;' cols=55 rows=29></textarea></td>
</tr>
</table>
<a href=#top>回最上面</a><p>
<a id=map></a>
<table>
<tr><td>D:\mud\map1x&emsp;<input type=button value='讀取' onclick='mapx_file_read(1)'>&ensp;
<input type=button value='存檔' onclick='mapx_file_save(1)'>&ensp;
<input type=button value='新增map2x' onclick='mapx_file_create(2)'><BR>
<textarea id=map1x style='font-size:16px;background-color:#93ED93;' cols=42 rows=19></textarea><BR></td>
<td>D:\mud\map1&emsp;<input type=button value='存檔' onclick='map_file_save(1)'><BR>
<textarea id=map1 style='font-size:16px;background-color:#93ED93;' cols=84 rows=19></textarea><BR></td></tr>
<tr><td id=mapx_area2></td><td id=map_area2></td></tr>
<tr><td id=mapx_area3></td><td id=map_area3></td></tr>
<tr><td id=mapx_area4></td><td id=map_area4></td></tr>
<tr><td id=mapx_area5></td><td id=map_area5></td></tr>
<tr><td id=mapx_area6></td><td id=map_area6></td></tr>
</table>
<a href=#top>回最上面</a><p>
<a id=long></a>
<table>
<tr><td>D:\mud\long1.h&emsp;<input type=button value='讀取' onclick='long_file_read(1)'>&ensp;
<input type=button value='存檔' onclick='long_file_save(1)'><BR>
<textarea id=long1 style="font-size:16px;background-color:#93ED93;" cols=80 rows=13></textarea><BR></td></tr>
<tr><td>D:\mud\long2.h&emsp;<input type=button value='讀取' onclick='long_file_read(2)'>&ensp;
<input type=button value='存檔' onclick='long_file_save(2)'><BR>
<textarea id=long2 style="font-size:16px;background-color:#93ED93;" cols=80 rows=13></textarea><BR></td></tr>
<tr><td>D:\mud\long3.h&emsp;<input type=button value='讀取' onclick='long_file_read(3)'>&ensp;
<input type=button value='存檔' onclick='long_file_save(3)'><BR>
<textarea id=long3 style="font-size:16px;background-color:#93ED93;" cols=80 rows=13></textarea><BR></td></tr>
</table>
<a href=#top>回最上面</a><p>
<a id=areah></a>
<table id=mob1_table>
<tr><td colspan=7>D:\mud\area.h&emsp;<input type=button value='讀取' onclick='areah_file_read()'>&ensp;
<input type=button value='存檔' onclick='areah_file_save(1)'></td></tr>
<tr><td>房間最多生幾隻怪</td><td colspan=6>:<input style="background-color:#93ED93;" size=3 dir=rtl type=text id=areah_1>&ensp;隻</td></tr>
<tr><td>房間經過多少秒怪重生</td><td colspan=6>:<input style="background-color:#93ED93;" size=3 dir=rtl type=text id=areah_2>&ensp;秒</td></tr>
<tr><td colspan=7><hr></td></tr>
<tr><td width=160>怪物1檔名</td><td colspan=6>:<input type=text style="background-color:#93ED93;" id=area_mob_11>&ensp;<input type=button onclick='mobs_add(2);' value='新增怪物2'></td></tr>
<tr><td>等級</td><td colspan=6>:<input type=text style="background-color:#93ED93;" id=area_mob_12 size=5></td></tr>
<tr><td>ID</td><td colspan=6>:<input type=text style="background-color:#93ED93;" id=area_mob_13></td></tr>
<tr><td>中文名</td><td colspan=6>:<input type=text style="background-color:#93ED93;" id=area_mob_14></td></tr>
<tr><td>道德</td><td colspan=6>:<input type=text style="background-color:#93ED93;" id=area_mob_15 size=3></td></tr>
<tr><td>金錢</td><td colspan=6>:<input type=text style="background-color:#93ED93;" id=area_mob_16 size=3></td></tr>
<tr><td>隻數</td><td colspan=6>:<input type=text style="background-color:#93ED93;" id=area_mob_17 size=3></td></tr>
<tr><td>額外設定資料</td><td colspan=6>:<input style="background-color:#93ED93;" type=text id=area_mob_18 size=40></td></tr>
</table>
<table id=mob2_table></table>
<table id=mob3_table></table>
<table id=mob4_table></table>
<table id=mob5_table></table>
<table id=mob6_table></table>
<table id=mob7_table></table>
<table id=mob8_table></table>
<table id=mob9_table></table>
<a href=#top>回最上面</a><p>
<a id=mob_droph></a>
<table>
<tr><td>D:\mud\mob_drop&emsp;<input type=button value='讀取' onclick='mob_drop_file_read()'>&ensp;
<input type=button value='存檔' onclick='mob_drop_file_save()'>&ensp;
<input type=button value='虛擬物品列表' onclick='show_vobjs()'><xxx id=vobjs_list></xxx><BR>
<textarea id=mob_drop style="font-size:16px;background-color:#93ED93;" cols=80 rows=13></textarea><BR></td></tr>
</table>
<a href=#top>回最上面</a><p>
<script type="text/javascript">
/*
var lives={
"東京":{
"涉谷1":"https://www.youtube.com/watch?v=lkIJYc4UH60",
"涉谷2":"https://www.youtube.com/watch?v=zGfw93Dqzg8",
"新宿":"https://www.youtube.com/watch?v=ZbekZoIwPl4",
"神田":"https://www.youtube.com/watch?v=nMHWi_WpqTg",
"台東區":"https://www.youtube.com/watch?v=gZtY_TsjmTo",
//x"涉谷3":"https://www.youtube.com/watch?v=5Nw6yJN0Sms",
//xx"秋葉原2":"https://www.youtube.com/watch?v=n3fYITuNy_Q",
//xx"秋葉原3":"https://www.youtube.com/watch?v=ALWuyEHAWv4",
//xx"神宮":"https://www.youtube.com/watch?v=kZEPYMWWF_k",
//xx"秋葉原":"https://www.youtube.com/watch?v=UkqrUmIpHko",
},
};
keys_lives=Object.keys(lives);
MEDIA_WIDTH=380;
MEDIA_HEIGHT=240;
str+="<th valign=top width="+MEDIA_WIDTH+" height="+MEDIA_HEIGHT+">"+keys_lives[i];
if(typeof(url)=="string")
urls=Object.keys(url);
for(j=0;j<urls.length;j++)
str+=" <a onclick='change_iframe(\""+keys_lives[i]+"\",\""+tmp+
"\")'><font color=blue><u>"+urls[j]+"</u></font></a>";
tmps=url[urls[0]].split("watch?v=");
tmp=tmps[0]+"embed/"+tmps[1]+"?rel=0&autoplay=1&controls=0&mute=1&vq=medium";
document.write(str);
function change_iframe(ee,uu)
{
document.getElementById(ee).src=uu;
}
*/
var fso=new ActiveXObject("Scripting.FileSystemObject");
function area_room_read(silent)
{
if(!fso.fileexists("D:\\mud\\area_room.c"))
return ;
if(!silent)
{
if(!confirm("確定讀取 D:\\mud\\area_room.c 檔案的內容嗎?"))
return ;
}
f=fso.opentextfile("D:\\mud\\area_room.c");
txt=f.readAll();
f.close();
txt=txt.replace(/\r/g,"");
tmps=txt.split("\n // 分隔區\n\n");
//if(tmps.length<5) return ;
document.getElementById("area_room1").value=""+tmps[1];
document.getElementById("area_room2").value=""+tmps[2];
document.getElementById("area_room3").value=""+tmps[3];
}
function area_room_save()
{
if(!confirm("確定對 D:\\mud\\area_room.c 進行存檔嗎?"))
return ;
p1=document.getElementById("area_room_part1").innerHTML;
p2=document.getElementById("area_room_part2").innerHTML;
p1=p1.replace(/&lt;/g,"<");
p1=p1.replace(/&gt;/g,">");
p1=p1.replace(/&amp;/g,"&");
p2=p2.replace(/&lt;/g,"<");
p2=p2.replace(/&gt;/g,">");
p2=p2.replace(/&amp;/g,"&");
a1=document.getElementById("area_room1").value;
a2=document.getElementById("area_room2").value;
a3=document.getElementById("area_room3").value;
txt=p1+"\n // 分隔區\n\n"+a1+"\n // 分隔區\n\n"+a2+"\n // 分隔區\n\n"+a3+"\n // 分隔區\n\n"+p2;
txt=txt.replace(/\n/g,"\r\n");
if(fso.fileexists("D:\\mud\\area_room.c"))
fso.deletefile("D:\\mud\\area_room.c");
f=fso.CreateTextfile("D:\\mud\\area_room.c");
f.writeLine(txt);
f.close();
}
function trans_mapx(mapx,k)
{
tmps=mapx.split("\n");
new_tmps=mapx.split("\n");
if(!k)
k=1;
for(i=0;i<tmps.length;i++)
{
tmp=tmps[i];
if(tmp.length<1) continue;
new_tmps[i]="";
for(j=0;j<tmp.length;j=j+2)
{
if(tmp[j]=="x")
{
if(k<10)
new_tmps[i]+="00"+k;
else if(k<100)
new_tmps[i]+="0"+k;
else
new_tmps[i]+=""+k;
k=k+1;
}
else if(tmp[j]=="|")
new_tmps[i]+=" | ";
else if(tmp[j]==" ")
new_tmps[i]+=" ";
if(j<tmp.length-1)
new_tmps[i]+=tmp[j+1];
}
}
tmp=new_tmps.join("\n");
return tmp;
}
function mapx_file_create(n,silent)
{
if(document.getElementById("mapx_area"+n).innerHTML!="")
return ;
if(!silent)
{
if(!confirm("確定新增一張map"+n+"?"))
return ;
}
txt="D:\\mud\\map"+n+"x&emsp;<input type=button value='讀取' onclick='mapx_file_read("+n+")'>&ensp;"+
"<input type=button value='存檔' onclick='mapx_file_save("+n+")'>&ensp;";
if(n<6)
txt+="<input type=button value='新增map"+(n+1)+"x' onclick='mapx_file_create("+(n+1)+")'>";
txt+="<BR><textarea id=map"+n+"x style='font-size:16px;background-color:#93ED93;' cols=42 rows=19></textarea><BR>";
document.getElementById("mapx_area"+n).innerHTML=txt;
txt2="D:\\mud\\map"+n+"&emsp;<input type=button value='存檔' onclick='map_file_save("+n+")'><BR>";
txt2+="<textarea id=map"+n+" style='font-size:16px;background-color:#93ED93;' cols=84 rows=19></textarea><BR>";
document.getElementById("map_area"+n).innerHTML=txt2;
if(!fso.fileexists("D:\\mud\\map"+n+"x"))
{
f=fso.CreateTextFile("D:\\mud\\map"+n+"x");
f.writeLine("");
f.close();
}
}
// 一開始就先創建目錄
if(!fso.FolderExists("D:\\mud"))
fso.CreateFolder("D:\\mud");
// area_room.c 載入區
area_room_read(1);
// map 載入區
for(m=1;m<=6;m++)
{
if(fso.fileexists("D:\\mud\\map"+m+"x"))
{
f=fso.opentextfile("D:\\mud\\map"+m+"x");
if(m>1)
mapx_file_create(m,1);
txt3=f.ReadAll();
f.close();
document.getElementById("map"+m+"x").value=txt3;
tt=1;
for(mm=1;mm<m;mm++)
{
tmp3=document.getElementById("map"+mm+"x").value;
tmps3=(" "+tmp3+" ").split("x");
tt+=tmps3.length-1;
}
document.getElementById("map"+m).value=trans_mapx(txt3,tt);
}
}
// long 載入區
for(i=1;i<=3;i++)
{
if(fso.fileExists("D:\\mud\\long"+i+".h"))
{
f=fso.OpenTextFile("D:\\mud\\long"+i+".h");
txt=f.readAll();
txts=txt.split("\n");
txt="";
for(ii=1;ii<txts.length;ii++)
{
if(txts[ii].length<4) continue;
tmp=txts[ii];
tmp=tmp.replace("\",\\","");
tmp=tmp.replace("\"","");
txt+=tmp+"\n";
}
document.getElementById("long"+i).value=txt;
f.close();
}
f.close();
}
function long_file_read(n)
{
if(!confirm("確定從 D:\\mud\\long"+n+".h 檔讀取內容進來嗎?"))
return ;
files="D:\\mud\\long"+n+".h";
if(!fso.FileExists(files))
txt="test1\ntest2\ntest3\n";
else
{
f=fso.OpenTextFile(files);
txt=f.readAll();
txts=txt.split("\n");
txt="";
for(i=1;i<txts.length;i++)
{
if(txts[i].length<4) continue;
tmp=txts[i];
tmp=tmp.replace("\",\\","");
tmp=tmp.replace("\"","");
txt+=tmp+"\n";
}
f.close();
}
document.getElementById("long"+n).value=txt;
}
function long_file_save(n)
{
if(!confirm("確定將內容儲存至 D:\\mud\\long"+n+".h 檔嗎?"))
return ;
files="D:\\mud\\long"+n+".h";
if(fso.fileexists(files))
fso.DeleteFile(files,true);
txt=document.getElementById("long"+n).value;
txts=txt.split("\n");
for(i=0;i<txts.length;i++)
{
if(txts[i].length<4) continue;
txts[i]="\""+txts[i]+"\",\\";
}
txt="#define LONG_MSG"+n+" ({\\\r\n"+txts.join("\r\n")+"})"
f=fso.CreateTextFile(files,1);
f.writeLine(txt);
f.close();
}
function mobs_add(n)
{
str="<tr><td colspan=7><hr></td></tr>"+
"<tr><td width=160>怪物"+n+"檔名</td><td colspan=6>:<input type=text style=background-color:#93ED93 id=area_mob_"+n+"1>&ensp;<input type=button onclick='mobs_add("+(n+1)+");' value='新增怪物"+(n+1)+"'></td></tr>"+
"<tr><td>等級</td><td colspan=6>:<input type=text style=background-color:#93ED93 id=area_mob_"+(n+1)+"2 size=5></td></tr>"+
"<tr><td>ID</td><td colspan=6>:<input type=text style=background-color:#93ED93 id=area_mob_"+(n+1)+"3></td></tr>"+
"<tr><td>中文名</td><td colspan=6>:<input type=text style=background-color:#93ED93 id=area_mob_"+(n+1)+"4></td></tr>"+
"<tr><td>道德</td><td colspan=6>:<input type=text style=background-color:#93ED93 id=area_mob_"+(n+1)+"5 size=3></td></tr>"+
"<tr><td>金錢</td><td colspan=6>:<input type=text style=background-color:#93ED93 id=area_mob_"+(n+1)+"6 size=3></td></tr>"+
"<tr><td>隻數</td><td colspan=6>:<input type=text style=background-color:#93ED93 id=area_mob_"+(n+1)+"7 size=3></td></tr>"+
"<tr><td>額外設定資料</td><td colspan=6>:<input style=background-color:#93ED93 type=text id=area_mob_"+(n+1)+"8 size=40></td></tr>";
document.getElementById("mob"+(n+1)+"_table").innerHTML=str;
}
function show_vobjs()
{
str="<select><option></option>";
tmp=document.getElementById("vobjs").innerHTML;
tmps=tmp.split("\n");
for(i=0;i<tmps.length;i++)
{
tmp=tmps[i];
tmp=tmp.replace(/ /g," ");
tmps2=tmp.split(" ");
str+="<option>"+tmps2[0]+" "+tmps2[1]+"</optiopn>";
}
str+="</select>";
document.getElementById("vobjs_list").innerHTML=str;
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment