vast 发表于 2004-6-19 15:18:15

门派职位的统一规范实现(zz)

作者:waiwai 更新日期:2004-01-16 类别:MUD文档->系统开发 总浏览/今日:13/1
rankd.c设置:
mapping titles=([
"方寸山三星洞":([
0   : ({"倒茶小童","迎客小童","扫地小童"}),
2   : ({"护院道人","看门道人","值夜道人"}),
5   : ({"掌经道长","掌钟道长","掌磬道长"}),
9   : ({"降魔天师","除妖天师","驱邪天师"}),
14 : ({"护国天尊","真武大帝","道德真君"}),
]),
"五庄观":([
0   : ({"行游散仙","入道散仙","修行散仙"}),
4   : ({"济世地仙","度劫地仙","离世地仙"}),
9   : ({"逍遥神仙","自在神仙","无碍神仙"}),
14 : ({"无拘天仙","无束天仙","超脱天仙"}),
]),
"月宫":([
0   : ({"护花仙女","近侍仙女","彩衣仙女"}),
4   : ({"彩云仙子","逐月仙子","蕴霞仙子"}),
9   : ({"望月仙妃","云霞仙妃","升雾仙妃"}),
14 : ({"风月神女","花月神女","雾月神女 "}),
]),
"大雪山":([
0   : ({"烧火小妖","巡山小妖","守门小妖"}),
4   : ({"烧火妖","巡山妖","守门妖"}),
9   : ({"公主护卫","巡山总管","内政总管"}),
14 : ({"先锋","中军","司务官"}),
]),
"东海龙宫":([
0   : ({"小鱼儿","小虾米","小螃蟹"}),
4   : ({"后勤虾兵","中军蟹兵","先锋鲨兵"}),
9   : ({"弯腰平海虾将军","横行无忌蟹将军","巨浪滔天鲸将军"}),
14 : ({"中军大将金刚龙","中军军师小白龙","中军军务赤须龙"}),
]),
"陷空山无底洞":([
0   : ({"剥皮小妖","剔骨小妖","嗜血小妖"}),
4   : ({"掠夺凶妖","杀人恶妖","护殿灵妖"}),
9   : ({"飞天蝙蝠","遁地蝙蝠","吸血蝙蝠"}),
14 : ({"钻天鼠","彻地鼠","钻山鼠"}),
]),
"南海普陀山":([
0   : ({"游方僧","化缘僧","知客僧","香积厨僧"}),
4   : ({"护院武僧","掌经僧","传法僧"}),
9   : ({"降龙罗汉","伏虎罗汉","金身罗汉"}),
14 : ({"三世佛","证果佛","论道佛"}),
]),
"阎罗地府":([
0   : ({"阴曹小鬼","勾魂小鬼","俏皮小鬼"}),
4   : ({"地府恶鬼","勾魂恶鬼","捣蛋恶鬼"}),
9   : ({"阴曹鬼判","勾魂无常","闹宅老鬼"}),
14 : ({"大力鬼王","索魂鬼王","闹世鬼王"}),
]),
"将军府": ([
0   : ({"前锋营小兵", "后卫营小兵", "帐前护卫"}),
4   : ({"仁勇校尉", "振威校尉", "昭武校尉"}),
9   : ({"云麾将军", "宣威将军", "定远将军"}),
14 : ({"膘骑大将军", "护国大将军", "远征大将军"}),
]),
"天蓬府": ([
0   : ({"天蓬小侠", "天蓬小兵", "天蓬护卫"}),
4   : ({"天蓬少侠", "天河使者", "天蓬护法"}),
9   : ({"天蓬大侠", "天河大将", "侠胆奇侠"}),
14 : ({"天蓬元帅", "天河尊者", "天蓬宗师"}),
]),
]);

int re_title(object master, object who)
{
string family_name;
int level, *levels, i, rand;

if(!who || !master)
return 0;
family_name=who->query("family/family_name");

if(!stringp(family_name)
|| undefinedp(titles))
return 0;

if(master->query("family/family_name")!=who->query("family/family_name"))
{
master->command("?");
master->command("say 你并不是本门弟子啊!n");
return 1;
}
if(who->query("zhangmen") || who->query("lord"))
{
master->command("spank "+who->query("id"));
master->command("say 你现在的职位已经很高了。n");
return 1;
}
level=grade_dx(describe_dx(who->query("daoxing")));
levels=keys(titles);
levels=sort_array(levels, "sort_keys", this_object());
for(i=0;i<sizeof(levels);i++)
if(level<levels)
break;
i--;
rand=random(sizeof(titles));
master->command("say 很好,我就赋予你「"+titles
+"」的称号吧。n");
who->set("title", family_name+titles);
return 1;
}


掌门文件的inquiry中加入:
"职位": (: re_title :),
"zhiwei": (: re_title :),

然后加入:
int re_title()
{
return RANK_D->re_title(this_object(), this_player());
}


这样的方式可以统一的在rankd.c里面实现改动,而不必每个门派去写NPC
文件,而把NPC文件搞的臃肿而乱糟糟的。。。
页: [1]
查看完整版本: 门派职位的统一规范实现(zz)