Пример #1
0
// Support.  Do we support this protocol?
void incoming_request(mapping info)
{
	if(!ACCESS_CHECK(previous_object())) return;

	if (stringp(info["NAME"]) && stringp(info["PORTUDP"])) {
		// dont want requests from ourself
		if(info["NAME"] == Mud_name()) return;

		if(!DNS_MASTER->dns_mudp(info["NAME"]))
			PING_Q->send_ping_q(info["HOSTADDRESS"], info["PORTUDP"]);

		// if the file exists that is enough to know that we support
		// it, unless there is a param request, in which case we have
		// to call_other to the file to check.
		if( file_size(AUX_PATH+info["CMD"]+".c") <= 0
		||	(!undefinedp(info["PARAM"])
		&&	call_other(AUX_PATH+info["CMD"], "support_"+info["PARAM"]))) {
			// we don't support it
			DNS_MASTER->send_udp(info["HOSTADDRESS"], info["PORTUDP"],
				sprintf("@@@%s||NAME:%s||PORTUDP:%d||CMD:%s||NOTSUPPORTED:yes||ANSWERID:%s@@@\n",
					DNS_SUPPORT_A, Mud_name(), udp_port(),
					info["CMD"]+ (!undefinedp(info["PARAM"]) ? "||PARAM:"+info["PARAM"] : ""),
					info["ANSWERID"]));
		} else {
			// we do support it
			DNS_MASTER->send_udp(info["HOSTADDRESS"], info["PORTUDP"],
				sprintf("@@@%s||NAME:%s||PORTUDP:%d||CMD:%s||SUPPORTED:yes||ANSWERID:%s@@@\n",
					DNS_SUPPORT_A, Mud_name(), udp_port(),
					info["CMD"]+(!undefinedp(info["PARAM"]) ? "||PARAM:"+info["PARAM"] : ""),
					info["ANSWERID"]));
		}
	} //if (stringp(info["NAME"]) && stringp(info["PORTUDP"]))
}
Пример #2
0
varargs mixed query(string prop, int raw) {
        mixed data, pdata; 
        if(!mapp(dbase)) {
                return 0;
        }
        
        if(undefinedp(dbase[prop]) && (strsrch(prop, '/')!=-1)) {
                data = _query(dbase, explode(prop, "/"));
        } else {
                data = dbase[prop];
        }
        
        if(default_ob) {
                if(undefinedp(data)) {
                        data = default_ob->query(prop, 1);
                } else if(mapp(data)) {
                        pdata = default_ob->query(prop, 1);
                        if(mapp(pdata)) {
                                data = pdata + data;
                        }
                }
        }
        
        if(raw) {
                return data;
        }
        
        return evaluate( data, this_object() );
} 
Пример #3
0
varargs mixed query_with_slash(string prop, int raw)
{
        mixed data; 
        if( !mapp(dbase) ) return 0; 
        if( undefinedp(dbase[prop]) && (strsrch(prop, '.')!=-1) )
                data = _query(dbase, explode(prop, "."));
        else
                data = dbase[prop]; 
        if( undefinedp(data) && default_ob )
                data = default_ob->query(prop, 1); 
        if( raw ) return data; 
        return evaluate( data, this_object() );
} 
Пример #4
0
int main(object me, string arg)
{
        mapping map;
        string *types, *skill, ski, map_to;
        int i, modify;
        string check;

	seteuid(getuid());
	if (arg) 
		sscanf(arg, "-%s %s", check, arg); 
	if (check=="check" && wizardp(me) && arg) {
		me = find_player(arg);
		if (!me) me = LOGIN_D->find_body(arg);
		if (!me) return notify_fail("没有这个人。\n");
		}

	if( !arg || check=="check" ) {
		map = me->query_skill_map();
		if( !mapp(map) || sizeof(map)==0 )
			return notify_fail(HIR"你现在没有使用任何特殊技能。\n"NOR);

		skill = keys(valid_types);
		write( CYN "以下是你目前使用中的特殊技能。\n" NOR );
		for (i=0; i<sizeof(skill); i++) {
			if( undefinedp(valid_types[skill[i]]) ) {
				map_delete(map, skill[i]);
				continue;
                        }
			if( !me->query_skill(skill[i]) ) continue;
			modify = me->query_temp("apply/" + skill[i]);
			printf( HIC "  %-20s "NOR+HIY" :"NOR+WHT" %-30s "NOR+RED"有效等级:%s%4d\n"NOR, 
				valid_types[skill[i]] + "(" + skill[i] + ")",
				undefinedp(map[skill[i]]) ? 
			             "无" : to_chinese(map[skill[i]]),
				(modify==0 ? HIW"+"NOR+YEL"" : (modify>0 ? HIC : HIR)),
				me->query_skill(skill[i]));
                }
                return 1;
        }

        if( arg=="?" ) {
                write(CYN"以下是可以使用特殊技能的种类:\n"NOR);
                skill = sort_array(keys(valid_types), (: strcmp :) );
                for(i=0; i<sizeof(skill); i++) {
                        printf("  %s (%s)\n", valid_types[skill[i]], skill[i] );
                }
                return 1;
        }
Пример #5
0
int quest_reward(object me, object who,object quest_item)
{
	mapping quest;
	int exp, pot, score;
	
	quest = quest_item->query("dynamic_quest");
	
	if (base_name(quest_item) != quest["file_name"])
		return 0;

	if (base_name(who) != quest["owner_name"]) 
		return 0;

        exp = 100 + random(400);
        pot = exp / (random(10) + 1);
        score = 50 + random(50);
        me->add("combat_exp",exp);
        me->add("potential",pot);
        me->add("score",score);
	tell_object(me,HIW"你被奖励了:\n" +
        	    chinese_number(exp) + "点实战经验\n"+
        	    chinese_number(pot) + "点潜能\n" +
        	    chinese_number(score)+"点江湖阅历\n"NOR);
	me->add("TASK",1);
	if ( !undefinedp(quest["fin_func"]))
		call_other(this_object(), quest["fin_func"], me, who, quest_item);
	if (quest_item)
		destruct(quest_item);
	return 1;
}
Пример #6
0
void update_day_phase()
{
	int i,j;
	object *inusers,envroom;
	string str;
	remove_call_out("update_day_phase");

	current_day_phase = (++current_day_phase) % sizeof(day_phase);
	if( !undefinedp(day_phase[current_day_phase]["event_fun"]) )
		call_other(this_object(), day_phase[current_day_phase]["event_fun"]);
        i=0;
        // here is modified by vikee 2001-2-15 13:15
        str=HIR"〖"HIY"窗外"HIR"〗:"NOR+day_phase[current_day_phase]["time_msg"];
        inusers=users();
        for (i;i<(j=sizeof(inusers));i++)
        {
            envroom=environment(inusers[i]);
            if (envroom)
           {
            if ( intp(envroom->query("outdoors")))
             {
               if (envroom->query("outdoors")<1)
             	tell_object(inusers[i],str+"\n");
               else 
               tell_object(inusers[i],day_phase[current_day_phase]["time_msg"]+"\n");
             }
            else
             {
             	tell_object(inusers[i],day_phase[current_day_phase]["time_msg"]+"\n");
             }
          }     
       }
       call_out("update_day_phase", day_phase[current_day_phase]["length"]);

}
Пример #7
0
string print_vars(mixed *vars) {
    string *result = allocate(sizeof(vars));
    int i;

    for (i=0; i<sizeof(vars); i++) {
	if (mapp(vars[i]))
	    result[i] = "([ ... ])";
	else if (functionp(vars[i]))
	    result[i] = "(: ... :)";
	else if (intp(vars[i]))
	{
	    if (vars[i]) result[i]=vars[i]+"";
	    else if (nullp(vars[i])) result[i]="NULL";
	    else if (undefinedp(vars[i])) result[i]="UNDEFINED";
	    else result[i]="0";
	}
	else if (stringp(vars[i]))
	    result[i] = "\""+vars[i]+"\"";
	else if (arrayp(vars[i]))
	    result[i] = "({ ... })";
	else if (floatp(vars[i]))
	    result[i] = vars[i]+"";
	else if (bufferp(vars[i]))
	    result[i] = "<BUFFER>";
    }
    return implode(result, ", ");
}
Пример #8
0
static string print_object(mixed ob)
{
  write(to_string(ob));

  if (intp(ob)) 
  {
    return "int";
  }
  else if (stringp(ob)) 
  {
    return "string";
  }
  else if (objectp(ob)) 
  {
    if (interactive(ob)) 
      return "user object";

    return "object";
  }
  else if (mappingp(ob))
  {
    return "mapping";
  }
  else if (arrayp(ob)) 
  {
    return "array";
  }
  else if (undefinedp(ob))
  {
    return "nil";
  }

  return "oh dear";
}
Пример #9
0
// They answered our finger request.  Nice of them.
void incoming_request(mapping info)
{
   object ob;
   mapping mudinfo;

   if(!ACCESS_CHECK(previous_object())) return;

   if (info["PORTUDP"] && info["NAME"]) {
     // dont want to finger ourselves
     if (info["NAME"] == Mud_name()) return ;

     // if we haven't got an entry for the mud, get one.
     if (!DNS_MASTER->dns_mudp(info["NAME"]))
        PING_Q->send_ping_q(info["HOSTADDRESS"], info["PORTUDP"]);

     // send the info to the player
     ob = find_player(info["ASKWIZ"]);
     if (ob) {
       mudinfo=DNS_MASTER->query_mud_info(info["NAME"]);
       message("finger", "\n"+
         ((!mudinfo || undefinedp(mudinfo["MUDNAME"]))?
           info["NAME"]:mudinfo["MUDNAME"])+
           "告诉你:\n"+info["MSG"],ob);
     }      
   }
}
Пример #10
0
string oppdir(string dir)
{
  if (!undefinedp(opp_dir[dir]))
    return opp_dir[dir];
  else
    return "";
}
Пример #11
0
string cdir(string dir)
{
  dir = abbrdir(dir);
  if (!undefinedp(chinese_dir[dir]))
    return chinese_dir[dir];
  else return dir;
}
Пример #12
0
string abbrdir(string dir)
{
  if (!undefinedp(abbr_dir[dir]))
    return abbr_dir[dir];
  else
    return dir;
}
Пример #13
0
varargs mapping query_action()
{
	string verb, *verbs;
	object me, wp1, wp2;
	object dragon;
	dragon=find_player("dragon");
	me=this_player();	
	verbs = previous_object()->query("verbs");

	// 4/27/98 mon changed following 4 "hit" to "impale"
	// as "hit" is not defined in weapon_actions.
	if( !pointerp(verbs) ) return weapon_actions["impale"];
	else {
		verb = verbs[random(sizeof(verbs))];
//		if(dragon)
//		tell_object(dragon,HIR+verb+NOR);
//		tell_object(me,HIY+verb+NOR);
		if(verb && me->query_temp("weapon"))
		{
		me->set_temp("kill_weapon",me->query_temp("weapon"));
		me->set_temp("kill_msg",verb);
		}
		if( !undefinedp(weapon_actions[verb]) ) return weapon_actions[verb];
		else return weapon_actions["impale"];
	}	
}
Пример #14
0
mixed defcheck(){
int err;
mixed ret;
err = catch( ret = boul5 );
if(err) ret = "DEFINED_D: error";
else if(undefinedp(ret)) ret = "DEFINED_D: undefined";
return ret;
}
Пример #15
0
void setup_monster(object ob)
{
	mapping my;

	my = ob->query_entire_dbase();

	my["unit"] = "只";
	
	if( undefinedp(my["gender"]) ) my["gender"] = "雄性";
	if( undefinedp(my["age"]) ) my["age"] = random(80) + 5;

	if( undefinedp(my["str"]) ) my["str"] = random(41) + 10;
	if( undefinedp(my["int"]) ) my["int"] = random(41) + 10;
	if( undefinedp(my["per"]) ) my["per"] = random(11) + 10;
	if( undefinedp(my["con"]) ) my["con"] = random(41) + 10;
	if( undefinedp(my["dex"]) ) my["dex"] = random(41) + 10;

	if( undefinedp(my["max_jing"]) ) {
		if( my["age"] <= 3 ) my["max_jing"] = 50;
		else if( my["age"] <= 10 ) my["max_jing"] = 50 + (my["age"] - 3) * 30;
		else if( my["age"] <= 60 ) my["max_jing"] = 260 + (my["age"] - 10) * 5;
		else my["max_jing"] = my["max_jing"] = 510 + (my["age"] - 60);
	}
	if( undefinedp(my["max_qi"]) ) {
		if( my["age"] <= 10 ) my["max_qi"] = 100;
		else if( my["age"] <= 30 ) my["max_qi"] = 100 + (my["age"] - 10) * 30;
		else my["max_qi"] = my["max_qi"] = 700 + (my["age"] - 30) * 10;
	}
	if( undefinedp(my["max_jingli"]) ) {
		if( my["age"] <= 10 ) my["max_jingli"] = 100;
		else if( my["age"] <= 30 ) my["max_jingli"] = 100 + (my["age"] - 10) * 50;
		else my["max_jingli"] = my["max_jingli"] =1000 + (my["age"] - 30) * 10;
	}
	//	NOTE: monster has no initial limbs defined, you must define it yourself.
	//	ob->init_limbs(LIMBS);
	if( !ob->query_weight() ) ob->set_weight(BASE_WEIGHT + (my["str"] - 10)* 2000);

	set("dead_message",       "\n$N仰天惨嚎了一声,趴在地上不动了。\n\n"      );
	set("unconcious_message", "\n$N咆哮一声,倒在地上昏了过去。\n\n"          );
	set("revive_message",     "\n$N慢慢睁开眼睛,清醒了过来。\n\n"            );
	set("comeout_message",    "往$d离开。\n"                                  );
	set("comein_message",     "缓缓地走了过来。\n"                            );
	set("fleeout_message",    "咆哮一声,往$d落荒而逃了。\n"                  );
	set("fleein_message",     "摇摇摆摆地跑了过来,伸出舌头呼呼地喘着粗气。\n");
}
Пример #16
0
/* determine whether two 法术 are 相克制
   if spell1 克制 spell2, then return = 1.
   if spell2 克制 spell1, then return = -1.
   otherwise, return 0.
   */
int skill_xiangke(string spell1, string spell2)
{
    int neutral=0;
    int result;
    
    if(undefinedp(table[spell1]) ||
	    undefinedp(table[spell2])) return neutral;

    if(member_array(spell1, table[spell2])>-1) {
	// spell2 can 克制 spell1.
	result=-1;
    } else if(member_array(spell2, table[spell1])>-1) {
	// spell1 can 克制 spell2.
	result=1;
    } else {
	result=neutral;
    }
    
    return result;
}
Пример #17
0
void update_day_phase()
{
	remove_call_out("update_day_phase");

	current_day_phase = (++current_day_phase) % sizeof(day_phase);
	message("outdoor:vision", HIG"【窗外】"NOR + day_phase[current_day_phase]["time_msg"] + NOR"。\n", users());
	if( !undefinedp(day_phase[current_day_phase]["event_fun"]) )
		call_other(this_object(), day_phase[current_day_phase]["event_fun"]);

	call_out("update_day_phase", day_phase[current_day_phase]["length"]);
}
Пример #18
0
mixed resolv_ref( mixed a )
{
  mixed ret;
  string ref_d;
  if( !stringp( a ) ) return a;
  if( !sscanf( a, "#%s", ref_d ) ) return a;
// Nightmare does not support cwf
// if( ref_d == "#" ) return (string)this_player()-> query( "cwf" );
  if( undefinedp( ret = get_ref( ref_d ) ) ) return a;
  return ret;
}
Пример #19
0
int main(object me, string arg)
{
	mapping map;
	string *types, *skill, ski, map_to;
	int i, modify;

	seteuid(getuid());

	if( !arg ) {
		map = me->query_skill_map();
		if( !mapp(map) || sizeof(map)==0 )
			return notify_fail("你现在没有使用任何特殊技能。\n");

		skill = keys(valid_types);
		write("以下是你目前使用中的特殊技能。\n");
		for (i=0; i<sizeof(skill); i++) {
			if( undefinedp(valid_types[skill[i]]) ) {
				map_delete(map, skill[i]);
				continue;
			}
			if( !me->query_skill(skill[i]) ) continue;
			modify = me->query_temp("apply/" + skill[i]);
			printf("  %-20s: %-20s  有效等级:%s%3d\n" NOR,
				valid_types[skill[i]] + " (" + skill[i] + ")",
				undefinedp(map[skill[i]]) ? "无" : to_chinese(map[skill[i]]),
				(modify==0 ? "" : (modify>0 ? HIC : HIR)),
				me->query_skill(skill[i]));
		}
		return 1;
	}

	if( arg=="?" ) {
		write("以下是可以使用特殊技能的种类:\n");
		skill = sort_array(keys(valid_types), (: strcmp :) );
		for(i=0; i<sizeof(skill); i++) {
			printf("  %s (%s)\n", valid_types[skill[i]], skill[i] );
		}
		return 1;
	}
Пример #20
0
varargs mapping query_apply_action()
{
        string verb, *verbs;
        object me, wp1, wp2;

        verbs = previous_object()->query("apply/verbs");

        if( !pointerp(verbs) ) return weapon_actions["impale"];
        else {
                verb = verbs[random(sizeof(verbs))];
                if( !undefinedp(weapon_actions[verb]) ) return weapon_actions[verb];
                else return weapon_actions["impale"];
        }       
}
Пример #21
0
string process_global_alias(string arg)
{
	string *word;

	if (arg[0]=='\'') return "say " + arg[1..strlen(arg)-1];

	word = explode(arg, " ");
	if( sizeof(word) && !undefinedp(global_alias[word[0]]) ) {
		word[0] = global_alias[word[0]];
		return implode(word, " ");
	}

	return arg;
}
Пример #22
0
int wear()
{
	object owner;
	mapping armor_prop, applied_prop;
	string *apply, type;
	int exp;
	
	// Only character object can wear armors.
	if( !(owner = environment())->is_character() ) return 0;

	// If already worn, just recognize it.
	if( query("equipped") ) return 1;

	// Check if we have "armor_prop" defined.
	if( !mapp(armor_prop = query("armor_prop")) )
		return notify_fail("你只能穿戴可当作护具的东西。\n");

	type = query("armor_type");

        if( file_size("/std/armor/"+type+".c") < 0 )
		return notify_fail("这件护具的格式设定错误, 请帮忙 post 通知巫师。\n");

	if( owner->query_temp("armor/" + type) )
		return notify_fail("你已经穿戴了同类型的护具了。\n");
	exp = (int)query("need_exp");
	if( (int)owner->query("combat_exp")<exp)
	    return notify_fail("你的经验值不足以穿戴此防具。\n");
	if (query("rain_cover"))
	  if (!owner->query_temp("rain_cover"))
	    owner->set_temp("rain_cover",1);
	  else return notify_fail ("你只能穿戴一件雨具。\n");
	if (query("thunder"))
	  if (!owner->query_temp("thunder"))
	    owner->set_temp("thunder",query("thunder"));
	  else return notify_fail ("你只能穿戴一件散雷器。\n");

	owner->set_temp("armor/" + type, this_object());
	apply = keys(armor_prop);
	applied_prop = owner->query_temp("apply");
	if( !mapp(applied_prop) ) applied_prop = ([]);
	for(int i = 0; i<sizeof(apply); i++)
		if( undefinedp(applied_prop[apply[i]]) )
			applied_prop[apply[i]] = armor_prop[apply[i]];
		else
			applied_prop[apply[i]] += armor_prop[apply[i]];
	owner->set_temp("apply", applied_prop);
	set("equipped", "worn");
	return 1;
}
Пример #23
0
static nomask mixed _query( mapping map, string *parts )
{
	mixed value;
	int i, s;

	value = map;
	s = sizeof( parts );
	for( i = 0 ; i < s ; i++ ) {
		if( undefinedp( value = value[parts[i]] ) )
			break;
		if( !mapp( value ) )
			break;
	}
	return value;
}
Пример #24
0
void log_command(string entry, int mem, int stime, int utime)
{
	if( !undefinedp(command_log[entry]) ) {
		command_log[entry]["count"] ++;
		command_log[entry]["mem"] += mem;
		command_log[entry]["stime"] += stime;
		command_log[entry]["utime"] += utime;
	} else if( sizeof(command_log) <= MAX_ENTRIES ) {
		command_log[entry] = ([
			"count" : 1,
			"mem"   : mem,
			"stime" : stime,
			"utime" : utime
		]);
	} else
Пример #25
0
void incoming_request(mapping info)
{
	mapping minfo;
	string tmsg;

#ifdef DEBUG
	set("channel_id", "网际巫师频道精灵");
	CHANNEL_D->do_channel(this_object(), "sys", "gwizmsg received from " + info["NAME"]);
#endif
	if(!ACCESS_CHECK(previous_object())) return;

	if (info["NAME"]) {
		if (info["NAME"] == Mud_name()) return ;

		minfo = DNS_MASTER->query_mud_info(info["NAME"]);
		if (!minfo || !strlen(info["WIZNAME"])
		|| !DNS_MASTER->dns_mudp(info["NAME"]))	{
			// We don't accept the message.  But ping them anyway.
			PING_Q->send_ping_q(info["HOSTADDRESS"], info["PORTUDP"]);

			return ;
		}
		if (info["HOSTADDRESS"] != minfo["HOSTADDRESS"]) {
			if (info["EMOTE"])
				tmsg = info["WIZNAME"]+"@"+info["NAME"]+" "+info["GWIZ"];
			else
				tmsg = info["WIZNAME"]+"@"+info["NAME"]+": "+info["GWIZ"];

			// Faked.  sheeze... 
			dns_log("dns_fake",sprintf( "Gwiz: %s %s\n%s", ctime(time()),
				info["HOSTADDRESS"],tmsg));
			DNS_MASTER->send_udp(info["HOSTADDRESS"], info["PORTUDP"],
				"@@@"+DNS_WARNING+
				"||NAME:"+Mud_name()+
				"||MSG: Fake gwiz msg: "+tmsg+
				"||FAKEHOST:"+info["HOSTADDRESS"]+
				"@@@\n");
			return;
		}
		if( undefinedp(info["CNAME"]) )
			set("channel_id", sprintf("%s@%s", info["WIZNAME"], info["NAME"]));
		else
			set("channel_id", sprintf("%s(%s@%s)", info["CNAME"], info["WIZNAME"], info["NAME"]));

		CHANNEL_D->do_channel(this_object(), "gwiz", info["GWIZ"], info["EMOTE"]);

    } //if (info["NAME"])
}
Пример #26
0
mapping query_action() {
        string verb, *verbs;
        
        verbs = this_object()->query("verbs");
        
        if(!pointerp(verbs)) {
                return weapon_actions["hit"];
        } else {
                verb = verbs[random(sizeof(verbs))];
                if(!undefinedp(weapon_actions[verb])) {
                        return weapon_actions[verb];
                } else {
                        return weapon_actions["hit"];
                }
        }
} 
Пример #27
0
varargs mapping query_action()
{
        string verb, *verbs;
        object me, wp1, wp2;

        verbs = previous_object()->query("verbs");

        // 4/27/98 mon changed following 4 "hit" to "impale"
        // as "hit" is not defined in weapon_actions.
        if( !pointerp(verbs) ) return weapon_actions["impale"];
        else {
                verb = verbs[random(sizeof(verbs))];
                if( !undefinedp(weapon_actions[verb]) ) return weapon_actions[verb];
                else return weapon_actions["impale"];
        }       
}
Пример #28
0
void incoming_request(mapping info)
{
	mapping minfo;
	string tmsg;

	if(!ACCESS_CHECK(previous_object())) return;

	if (info["NAME"]) {
		if (info["NAME"] == Mud_name()) return ;

		minfo = DNS_MASTER->query_mud_info(info["NAME"]);
		if (!minfo || !strlen(info["USRNAME"])
		|| !DNS_MASTER->dns_mudp(info["NAME"]))	{
			// We don't accept the message.  But ping them anyway.
			PING_Q->send_ping_q(info["HOSTADDRESS"], info["PORTUDP"]);
			return ;
		}
		if (info["HOSTADDRESS"] != minfo["HOSTADDRESS"]) {
			if (info["EMOTE"])
				tmsg = info["USRNAME"]+"@"+info["NAME"]+" "+info["MSG"];
			else
				tmsg = info["USRNAME"]+"@"+info["NAME"]+": "+info["MSG"];

			// Faked.  sheeze... 
			dns_log("dns_fake",sprintf( "Gchannel: %s %s\n%s", ctime(time()),
				info["HOSTADDRESS"],tmsg));
			DNS_MASTER->send_udp(info["HOSTADDRESS"], info["PORTUDP"],
				"@@@"+DNS_WARNING+
				"||NAME:"+Mud_name()+
				"||MSG: Fake gchannel msg: "+tmsg+
				"||FAKEHOST:"+info["HOSTADDRESS"]+
				"@@@\n");
			return;
		}

		info["NAME"]=upper_case(info["NAME"]);
		//mon 1/14/98

		if( undefinedp(info["CNAME"]) )
			set("channel_id", sprintf("%s@%s", info["USRNAME"], info["NAME"]));
		else
			set("channel_id", sprintf("%s(%s@%s)", info["CNAME"], info["USRNAME"], info["NAME"]));

		CHANNEL_D->do_channel(this_object(), lower_case(info["CHANNEL"]), info["MSG"], info["EMOTE"]);

    } //if (info["NAME"])
}
Пример #29
0
void incoming_request(mapping info)
{
	mapping rhost;
	object ob;

	if(!ACCESS_CHECK(previous_object())) return;

	if (undefinedp(info["CHANNEL"])) return;

	if (info["NAME"]) {
		if (info["NAME"] == Mud_name()) return ;

		rhost = DNS_MASTER->query_mud_info(info["NAME"]);
		if (!rhost || !DNS_MASTER->dns_mudp(info["NAME"]))	{
			// We don't accept the message.  But ping them anyway.
			PING_Q->send_ping_q(info["HOSTADDRESS"], info["PORTUDP"]);
			return ;
		}
		if (info["HOSTADDRESS"] != rhost["HOSTADDRESS"]) {
			// Faked.  sheeze... 
			dns_log("dns_fake",sprintf( "Gchannel: %s %s\n%s", ctime(time()),
				info["HOSTADDRESS"],info["MYINFO"]));
			DNS_MASTER->send_udp(info["HOSTADDRESS"], info["PORTUDP"],
				"@@@"+DNS_WARNING+
				"||NAME:"+Mud_name()+
				"||MSG: Fake remote_q msg: "+info["CHANNEL"]+
				"||FAKEHOST:"+info["HOSTADDRESS"]+
				"@@@\n");
			return;
		}
 
		ob=find_player(info["TARGET_ID"]);
		if(!userp(ob)) return;
		if( ob->is_ghost() || ob->query("env/invisibility") > 0 ) return;
		DNS_MASTER->send_udp(rhost["HOSTADDRESS"], rhost["PORTUDP"],
			"@@@" + "remote_a" +
			"||NAME:" + Mud_name() +
			"||PORTUDP:" + udp_port() +
			"||CHANNEL:" + info["CHANNEL"] +
			"||SOURCE_ID:" + info["SOURCE_ID"] +
			"||MSG:"  + info["MSG"] +
			"||TARGET:" + sprintf("mud=%s name=%s id=%s age=%d gender=%s respect=%s rude=%s ",
			Mud_name(),ob->query("name"),ob->query("id"),ob->query("age"),ob->query("gender"),
			RANK_D->query_respect(ob),RANK_D->query_rude(ob) )
			+ "@@@\n");
	}
}
Пример #30
0
int do_get(object me, object obj, object old_env)
{
	object *enemy;
	int equipped;
	object* inv;
/*
	inv = all_inventory(me);
	if( sizeof(inv) > 30 )
	   return notify_fail("你身上再也装不下任何东西了。\n");
*/
	if( !obj ) return 0;
	if(!old_env) old_env = environment(obj);

	if( obj->is_character() ) {
		if( living(obj) ) return 0;
		//	if( !userp(obj) && !obj->is_corpse() )
		//		return notify_fail("你只能背负其他玩家的身体。\n");
		// If we try to save someone from combat, take the risk :P
	} else {
		if( obj->query("no_get") ) return 0;
	}

	if( obj->query("equipped") ) equipped = 1;
	if( obj->move(me) ) {
		if( me->is_fighting() ) me->start_busy(1);
		if( obj->is_character() )
		  message_vision( "$N将$n扶了起来背在背上。\n", me, obj );
		else
		  message_vision( sprintf("$N%s一%s$n。\n", 
		  (!old_env || old_env==environment(me))? "捡起":
		  (old_env->is_character() ?
		  "从" + old_env->name() + "身上" + (equipped? "除下" : "搜出"):
		  "从" + old_env->name() + "中拿出"),
	          undefinedp(obj->query("unit"))?
	          "个":obj->query("unit")
		  ), me, obj );
		  if(obj->query("obj_owner")&&obj->query("obj_owner")!=me->query("id"))
		  { write("结果一不小心 ,"+obj->query("name")+"从你身上掉下来摔成了粉碎!\n");
		    destruct(obj);
		   }
		return 1;
	}
	else return 0;
}