六、修改/feature/message.c文件如下:
Copy code
string prompt()
{
string p;
string prompt, path;
mixed list;
mapping my;
// 区别tomud显示方式和zmud
if (arrayp(list = query_temp("tell_list")) &&
sizeof(list) > 1)
{
if (! this_object()->query_temp("tomud"))
p = HIG "> " NOR;
else
p = HIG "<有信息>" NOR;
}
else
{
if (! this_object()->query_temp("tomud"))
p = HIY "> " NOR;
else
p = "";
}
if (! stringp(prompt = query("env/prompt")))
return p;
switch (prompt)
{
case "time":
p = HIC + ctime(time())[11..18] + p;
break;
case "date":
p = HIC + ctime(time())[0..9] + p;
break;
case "mud":
p = HIC + NATURE_D->game_time() + p;
break;
case "hp":
if (! this_object()->query_temp("tomud"))
p = HIG + sprintf("%d/%d", query("jing"), query("qi")) + p;
else
{
// tomud客户端激活hp状态栏
my = query_entire_dbase();
p = TMI("statu " + sprintf("精%d气%d精力%d内力%d食%d水%d潜能%d经验%d",
my["jing"], my["qi"], my["jingli"], my["neili"],
my["food"], my["water"], my["potential"] - my["learned_points"],
my["combat_exp"]) + p);
}
break;
case "path":
if (! wizardp(this_object()) || wiz_level(this_object()) < 3)
break;
if (! stringp(path = query("cwd")))
{
path = "/";
set("cwd", path);
}
// p = HIC + path[0..<2] + p;
p = HIC + path[0..<2] + HIC "/ " NOR;
break;
default:
p = prompt + p;
break;
}
return p;
}
void receive_message(string msgclass, string msg)
{
string subclass, *ch;
if (query_temp("big5"))
#ifdef LONELY_IMPROVED
msg = gbtobig5(msg);
#else
msg = LANGUAGE_D->GB2Big5(msg);
#endif
if (! interactive(this_object()))
{
this_object()->relay_message(msgclass, msg);
return;
}
if (msgclass == "telnet")
{
receive(msg);
return;
}
if (sscanf(msgclass, "%s:%s", subclass, msgclass) == 2)
{
switch(subclass)
{
case "channel":
if (! pointerp(ch = query("channels"))
|| member_array(msgclass, ch) == -1)
return;
// 配合tomud客户端信息框显示信息
if (this_object()->query_temp("tomud"))
{
if (! query("chann/" + msgclass))
msg = PTEXT(msg); // 默认往公共窗口扔频道信息
}
break;
case "outdoor":
if (! environment() || ! environment()->query("outdoors"))
{
if (query("env/look_window"))
msg = HIG "【窗外景象】" +
NOR + msg;
else
return;
}
break;
case "system":
break;
default:
error("Message: Invalid Subclass " + subclass + ".\n");
}
}
if (query_temp("block_msg/all") || query_temp("block_msg/" + msgclass))
return;
if (in_input(this_object()) || in_edit(this_object()) ||
this_object()->is_attach_system() && msgclass != "system")
{
if (sizeof(msg_buffer) < MAX_MSG_BUFFER)
msg_buffer += ({ msg });
} else
{
log_message(msg);
if (written && ! this_object()->is_attach_system())
{
if (written == COMMAND_RCVD)
{
written = NONE;
// 仅非tomud客户端做处理
if (! this_object()->query_temp("tomud"))
msg = ESC "[256D" ESC "[K" + msg;
} else
{
if (! this_object()->query_temp("tomud"))
msg = ESC "[256D" ESC "[K" + msg + prompt();
else
// tomud客户端处理
msg = msg + prompt();
}
}
while (strlen(msg) > MAX_STRING_SIZE)
{
receive(msg[0..MAX_STRING_SIZE - 1]);
msg = msg[MAX_STRING_SIZE..<1];
}
receive(msg);
}
}
// 以下内容你只要注意包含tomud字符的几行就可以
void write_prompt()
{
if (sizeof(msg_buffer))
{
receive(BOLD "[输入时暂存讯息]\n" NOR);
for(int i = 0; i < sizeof(msg_buffer); i++)
receive(msg_buffer[i]);
msg_buffer = ({});
}
if (! living(this_object()))
return;
if (this_object()->is_attach_system())
receive(HIR "执行中" HIY "> " NOR);
else
{
if (! this_object()->query_temp("tomud"))
receive(ESC "[256D" + prompt());
else
receive(prompt());
}
written = PROMPT_WRITTEN;
}
void receive_snoop(string msg)
{
object ob;
if ((msg[0..5] == ESC "[256D") && (msg[6..8] != ESC "[K"))
// Don't snoop prompt
return;
if (objectp(ob = query_snooping(this_object())))
{
if (ob->query_temp("big5") &&
! this_object()->query_temp("big5"))
#ifdef LONELY_IMPROVED
msg = big5togb(msg);
#else
msg = LANGUAGE_D->Big52GB(msg);
#endif
else
if (! ob->query_temp("big5") &&
this_object()->query_temp("big5"))
#ifdef LONELY_IMPROVED
msg = gbtobig5(msg);
#else
msg = LANGUAGE_D->GB2Big5(msg);
#endif
}
msg = replace_string(msg, ESC "[1A", "");
msg = replace_string(msg, NOR, NOR BBLU WHT);
// msg = replace_string(msg, ESC "[K", NOR ESC "[K" BBLU WHT);
if (! this_object()->query_temp("tomud"))
msg = BBLU WHT + msg + NOR + " " + ESC "[1D";
else
msg = BBLU WHT + msg + NOR + " ";
while (strlen(msg) > MAX_STRING_SIZE)
{
receive(msg[0..MAX_STRING_SIZE - 1]);
msg = msg[MAX_STRING_SIZE..<1];
}
receive(msg);
}