コード例 #1
0
ファイル: _listen.c プロジェクト: ClockworkSoul/MortalRemains
int
cmd_listen(string str) {

mixed listen_prop;
string * to_hear;

    listen_prop = environment(this_player())->query("listen");
  if (!str) say(TPN + " listens intently.\n");

    notify_fail(FAIL_MSG);

// If the room has no listen set, this should fail.  Likewise if "listen" is
//   not a string or mapping.

    if(!listen_prop || (!stringp(listen_prop) && !mapp(listen_prop))) return 0;
    
// If "listen" is a mapping, it should be treated like this.

    if(mapp(listen_prop)) {
        to_hear = keys(listen_prop);
        if(!str) str = "default";
        if(member_array(str, to_hear) == -1) return 0;
        write(listen_prop[str]);
        return 1;
    }

// If "listen" is a string, trying to listen to something in particular fails.

    if(str) return 0;
    write(listen_prop);
    return 1;
}
コード例 #2
0
ファイル: fangqi.c プロジェクト: heypnus/xkx2001
int main(object me, string arg)
{
	mapping skills, skillmap;
	string *skill;
	int i;
	
	if( !arg || arg=="" ) 
		return notify_fail("你要放弃哪一项技能?\n");

	if( !me->delete_skill(arg) )
		return notify_fail("你并没有学过这项技能。\n");

	write("你决定放弃继续学习" + to_chinese(arg) + "。\n");

	if( arg =="all" ) {
		skills = me->query_skills();
		if( !mapp(skills) || sizeof(skills)==0 ) return 1;

		skill = keys(skills);
		for (i=0; i<sizeof(skill); i++) {
			me->delete_skill(skill[i]);
		}
	} else {		 
		skillmap = me->query_skill_map();
		if( !mapp(skillmap) || sizeof(skillmap)==0 ) return 1;

		skill = keys(skillmap);
		for (i=0; i<sizeof(skill); i++) {
			if( skillmap[skill[i]] == arg ) me->map_skill(skill[i]);
		}
	}
	
	return 1;
}
コード例 #3
0
ファイル: main.cpp プロジェクト: Rincevent/lbanet
int main(int argc, char** argv)
{
	ilInit();
	iluInit();



	for(int i=0; i<=133; ++i)
	{
		// export graphic
		LBA_MAP_GL map(i, 0);
		map.ExportMapOSG();

		//export physic
		LBA_MAP_PHYS mapp(i, 0);
	}

	for(int i=1; i<=138; ++i)
	{
		// export graphic
		LBA_MAP_GL map(i, 1);
		map.ExportMapOSG();

		//export physic
		LBA_MAP_PHYS mapp(i, 1);
	}

	return 0;
}
コード例 #4
0
ファイル: Hardware.cpp プロジェクト: jjg/microtouch
u8 Hardware_::GetTouch(TouchData* e)
{
    // dim backlight as battery dies
	while ((OCR3A > 10) && (GetBatteryMillivolts() < 3700))
		OCR3A--;

	TouchState& st = _touchState;
	e->pressure = TouchOversample(&e->x,&e->y);

	// Debounce
	if ((e->pressure == 0) != (st.last.pressure == 0))
	{
		u32 t = GetPerfCounter();
		u32 elapsed = t - st.changed;
		if (elapsed < 10*2000L)			// 10ms debounce factor
			*e = st.last;				// copy old state
		else
			st.changed = t;	// State has been the same for 5 ms
	}
	st.last = *e;

	if (e->pressure)
	{
		TouchConfig& t = _touchConfig;
		e->x = mapp(e->x,t.x0,t.x1,240);
		e->y = mapp(e->y,t.y0,t.y1,320);
		_powerOffCount = POWER_OFF_COUNT;	// reset auto off
	}
	DATAOUT;
	return e->pressure;
}
コード例 #5
0
ファイル: dbase.c プロジェクト: mudchina/fy4
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() );
} 
コード例 #6
0
ファイル: master.c プロジェクト: huangleon/fy2005
int prevent_learn(object me, string skill)
{
    mapping my_family, family;
    int	betrayer, mylvl, lvl;

    lvl = this_object()->query_skill(skill, 1);
    mylvl = me->query_skill(skill, 1);
    if( betrayer = me->query("betrayer") )
    {
        if( mylvl >= lvl - betrayer * 20 )
        {
            message_vision("$N神色间似乎对$n不是十分信任,\n"
                           "也许是想起$p从前背叛师门的事情\n...。\n",
                           this_object(), me );
            command("say 嗯 .... \n师父能教你的都教了,其他的你自己练吧。");
            return 1;
        }
    }

    if( !me->is_apprentice_of(this_object()))
    {
        if( !mapp(my_family = me->query("family")) )  return 0;
        if( !mapp(family = this_object()->query("family")) ) return 0;
        if((my_family["family_name"] == family["family_name"]) )
        {
            command("hmm");
            command("pat " + me->query("id"));
            command("say 虽然你我同门,可是你并非我的弟子,"
                    "你还是去找你师父学吧....");
            return 1;
        }
    }

    return 0;
}
コード例 #7
0
ファイル: alias.c プロジェクト: mudchina/fy2
int set_alias(string verb, string replace)
{
	if( !replace ) {
		if( mapp(alias) ) map_delete(alias, verb);
		return 1;
	} else {
		if( !mapp(alias) ) alias = ([ verb:replace ]);
		else if( sizeof(alias) > MAX_ALIASES )
			return notify_fail("您设定的 alias 太多了,请先删掉一些不常用的。\n");
		else alias[verb] = replace;
		return 1;
	}
コード例 #8
0
ファイル: gchannel.c プロジェクト: gongfuPanada/mhxy2002
// This is the interface to the intermud channels
void send_msg(string channel, string id, string name, string msg, int emoted,
	mixed filter)
{
	string *names;
	int i;
	mapping muds;
	mapping svcs;
	mapping minfo;

	if( !this_player()		// Prevent from being called by ourself.
	||	!ACCESS_CHECK(previous_object())) return;

#ifdef DEBUG
	set("channel_id", "网路频道精灵");
	CHANNEL_D->do_channel(this_object(), "sys", "prepare to send gchannel message.");
#endif
	muds = (mapping)DNS_MASTER->query_muds();
	svcs = (mapping)DNS_MASTER->query_svc();
	msg = replace_string(msg, "|", "");
	msg = replace_string(msg, "@@@", "");
	// use keys(svcs) because none of the muds not in svcs can possibley
	// receive the message
	names = keys(svcs);
	i = sizeof(names);
	while(i--)
		if( (names[i] != mud_nname())
		&&	evaluate(filter, muds[names[i]])
		&& (muds[names[i]]["MUDLIB"]=="Eastern Stories"
		||  muds[names[i]]["MUDLIB"]=="A Journey to the West") ) {
			minfo = muds[names[i]];
			if(!mapp(minfo) || !mapp(svcs[names[i]])
			|| !(svcs[names[i]]["gwizmsg"] & SVC_UDP))
				continue;
#ifdef DEBUG
	set("channel_id", "网路频道精灵");
	CHANNEL_D->do_channel(this_object(), "sys",
		sprintf("gchannel message sent to %s.", minfo["NAME"]));
#endif
			DNS_MASTER->send_udp(minfo["HOSTADDRESS"], minfo["PORTUDP"],
				"@@@" + DNS_GCHANNEL +
				"||NAME:" + Mud_name() +
				"||PORTUDP:" + udp_port() +
				"||USRNAME:" + capitalize(id) +
				"||CNAME:" + name +
				"||MSG:" + msg +
				"||CHANNEL:" + channel +
				(emoted?"||EMOTE:1":"") + "@@@\n");
		}
}
コード例 #9
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;
}
コード例 #10
0
ファイル: fate.c プロジェクト: wingkit/xyj-ali
void start_fate(object ob)
{
    string keyword;
    function f;

    keyword = ob->query("fate_keyword");
    if (!keyword)
        keyword = file_name(ob);

    if (!mapp(fates) || !functionp(f = fates[keyword])) {
        if (!mapp(eternal_fates) || !stringp(eternal_fates[keyword])) return;
        f = (: call_other, FATE_D(eternal_fates[keyword]), "start_fate", this_object() :);
    }
    evaluate(f);
}
コード例 #11
0
int ins(string s,int p){
	for (int l = s.length(),x = 0,i = 0,w;i < l;i++){
		if (!son[x][w = mapp(s[i])]) son[x][w] = ++tot;
		x = son[x][w];
		if (i == l - 1) id[x] |= (1 << p);
	}
}
コード例 #12
0
ファイル: fengdoor.c プロジェクト: huangleon/fy2005
int valid_leave(object me, string dir)
{
        object ob,room;
        int i;
        mapping condition;
        string *type;
        if( userp(me) && dir == "north")
		{
			condition = me->query_all_condition();
			if( mapp(condition) ) {
				type=keys(condition);
				for (i=0;i<sizeof(type);i++) {
					if (type[i]!="drunk" && type[i]!="buffed" && type[i]!="bandaged")
						return notify_fail("你身罹怪疾,不得进入探花诗台。\n");
				} 
	      	}	
	
			if(me->query("eff_sen")<me->query("max_sen")*95/100
				||me->query("eff_kee")<me->query("max_kee")*95/100
				||me->query("eff_gin")<me->query("max_gin")*95/100 )
				return notify_fail("你伤痕累累,探花诗台不是你的坟场。\n");
		
			tell_object(me,HIR"你进入了比武地区,在探花楼主楼内可自由叫杀,无死亡损失。\n\n"NOR);
		
		}	
		return 1;
}
コード例 #13
0
ファイル: trashcan2.c プロジェクト: gongfuPanada/mhxy2002
int clean_trash()
{
	mapping exits;
	string *dirs;
	string last_dir;
	if( last_dir = this_object()->query("last_dir"))
	{
        if( !mapp(exits = environment()->query("exits")) ) 
	{
	destruct(this_object());
	return 0;
	}
        dirs = keys(exits);
	if( member_array(last_dir, dirs) != -1)
	{
	if( random(2) )
		command("go "+ last_dir);
	else
		randommove();
	}		
	else
		randommove();
		

	}
	else
		randommove();
}
コード例 #14
0
ファイル: dbase.c プロジェクト: mudchina/fy4
mixed set(string prop, mixed data)
{
        if( !mapp(dbase) ) dbase = ([]); 
        if( strsrch(prop, '/')!=-1 )
                return _set( dbase, explode(prop, "/"), data );
        return dbase[prop] = data;
}
コード例 #15
0
ファイル: dbxframe.c プロジェクト: Lundex/lima
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, ", ");
}
コード例 #16
0
ファイル: spsk.c プロジェクト: aricxu/xkx100
int main(object me, string arg)
{
	object ob;
	mapping skl, lrn, map;
	string *sname, *mapped, str;
	int i;

	seteuid(getuid());

	if(!arg)
		ob = me;
	else{
		ob = present(arg, environment(me));
//        if ( ob->query("SPSKILLS",1)  ) return ob->skills();		 
		if (!ob) ob = find_player(arg);
		if (!ob) ob = find_living(arg);
		if (!ob) return notify_fail("你要察看谁的技能?\n");
	}

	skl = ob->query_skills();
	if(!sizeof(skl)) {
		write( (ob==me ? "你" : ob->name()) + "目前并没有学会任何技能。\n");
		return 1;
	}
	write( (ob==me ? "你" : ob->name()) +"目前所学过的技能:\n\n");
	sname  = sort_array( keys(skl), (: strcmp :) );
	
	map = ob->query_skill_map();
	if( mapp(map) ) mapped = values(map);
	if( !mapped ) mapped = ({});
コード例 #17
0
ファイル: damage.c プロジェクト: teardemon/fy4
varargs int receive_damage(string type, int damage, object who)
{
        int val;
        int reduction,r_damage;
         
//  if( damage < 0 ) error("F_DAMAGE: 伤害值为负值。\n");
        if (damage <0) damage =0;
        if( type!="gin" && type!="kee" && type!="sen" )
                error("F_DAMAGE: 伤害种类错误( 只能是 gin, kee, sen 其中之一 )。\n"); 
           if (query("resistance/"+type) || query_temp("resistance/"+type)){
                reduction=query("resistance/"+type) + query_temp("resistance/"+type);
                damage=damage-damage*reduction/100;
        } 
        if( objectp(who) ) set_temp("last_damage_from", who);
        val = (int)query(type) - damage;
        
//      这个是用来记录NPC作战对手的伤害力。精神的计算值x2,对玩家虽然有记录,但是没有现实意义。 
        if (who) {
                if (query("kee")==query("max_kee") && query("eff_kee")==query("max_kee")
                        && query("kee")==query("max_kee") && query("eff_kee")==query("max_kee")
                        && query("kee")==query("max_kee") && query("eff_kee")==query("max_kee"))
                        damage_list=([]);       // NPC 复原时清零。
        
                if (type!="kee") r_damage=damage*2;
                        else r_damage=damage;
                if( !mapp(damage_list) )
                        damage_list = ([ who : r_damage ]);
                else  
                        damage_list[who]=damage_list[who]+r_damage;
        }
コード例 #18
0
ファイル: sun.c プロジェクト: heypnus/xkx2001
void attempt_apprentice(object ob)
{
	mapping fam;
	string name,new_name;

	if( mapp(fam = ob->query("family")) && fam["family_name"] != "全真教" )
	{
		command ("say " + RANK_D->query_respect(this_player())
			+ "并非我门中人,习武还是先从各位道长起吧!");
		return;
	}

	if ((int)ob->query_skill("xiantian-gong", 1) < 50) {
		command("say 我全真教乃内家武功,最重视内功心法。");
		command("say " + RANK_D->query_respect(ob) +
			"是否还应该在玄门先天功上多下点功夫?");
		return;
	}

	if ((int)ob->query("shen") < 35000) {
		command("say 我全真教乃是堂堂名门正派,对弟子要求极严。");
		command("say 在德行方面," + RANK_D->query_respect(ob) +
			"是否还做得不够?");
		return;
	}
	command("say 好吧,贫道就收下你了。");
	name = ob->query("name");
	new_name = name[0..01]+"志" + name[4..5];
	command("say 从今以后你就叫做" + new_name + "。");
	ob->set("name",new_name);
	command("recruit " + ob->query("id"));
}
コード例 #19
0
ファイル: bandaged.c プロジェクト: heypnus/xkx2001
int update_condition(object me, int duration)
{
	mapping drug_app;
	string *type;
	int i;

	if( mapp(drug_app = me->query_temp("medication")) )
		type = keys(drug_app);

	if( sizeof(type) )
		for( i=0; i < sizeof(type); i++ )
		{
			switch( type[i] )
			{
			case "vulnerary":
				if( (int)me->query("eff_qi") < (int)me->query("max_qi") )
					me->receive_curing("qi", drug_app[type[i]]);
				if( wizardp(me) ) tell_object(me, "жнсЗё╨"+drug_app[type[i]]+"\n");
				if( drug_app[type[i]] == 10 )
					tell_object(me, "╠а╢Ьио╣дикр╘╫╔╫╔й╖х╔акр╘птё╝ё╝\n");
				break;
			}
			drug_app[type[i]] -= 1;
			if( drug_app[type[i]] > 0 )
				me->set_temp("medication/"+type[i], drug_app[type[i]]);
			else me->delete_temp("medication/"+type[i]);
		}
	else if( (int)me->query("eff_qi") < (int)me->query("max_qi") )
		me->receive_curing("qi", 3+random(5));

	me->apply_condition("bandaged", duration - 1);
	if( !duration ) return 0;

	return CND_CONTINUE;
}
コード例 #20
0
ファイル: which.c プロジェクト: abzde/dock9
int main(string args)
{
    string *commandPath = this_player()->query_path();
    mixed *actions = previous_object()->query_commands();
    mapping aliases = this_player()->get_aliases(1);
    int i, isLocated = 0;
    
    if(!args) return notify_fail("Error: Syntax: which <verb/command>\n");
    
    for(i = 0; i < sizeof(commandPath); i ++)
    {
	    if(file_exists(commandPath[i] + args + ".c"))
	    {
	        isLocated = 1;
    	    write(commandPath[i] + args + "\n");
    	}
    }
    
    for(i = 0; i < sizeof(actions); i++)
    {
        if(actions[i][0] == args)
        {
            isLocated = 1;
            write("Local:  " + sprintf("%O/%s", actions[i][2], actions[i][3]) + "\n");
        }
    }
    
    if(mapp(aliases) && aliases[args])
    {
        isLocated = 1;
        write("Alias: " + args + " -> " + aliases[args] + "\n");
    }
    
    if(member_array(args, SOUL_D->query_emotes()) != -1)
    {
        isLocated = 1;
        write("Soul: " + args + "\n");
    }
    
    
    if(member_array(args + "/t", SOUL_D->query_emotes()) != -1)
    {
        isLocated = 1;
        write("Targetted Soul: " + args + "\n");
    }
    
    if(environment(previous_object())->valid_exit(args))
    {
        isLocated = 1;
        write("Local Exit: " + 
            environment(this_player())->query_exit(args) + "\n");
    }
        
    
    if(!isLocated) return notify_fail("%^RED%^Error:%^RESET%^ '" + args 
        + "' not found in " +  implode(commandPath, ", ") 
         + " nor via a local add_action, alias, soul, or exit.\n");
    
    return 1;   
}
コード例 #21
0
ファイル: study.c プロジェクト: gongfuPanada/xyj45
int main(object me, string arg)
{
   object ob;
   mapping skill;
   int cost, my_skill;
   
    if(environment(me)->query("no_fight") || 
       environment(me)->query("no_magic") )
          return notify_fail("安全区内禁止练功。\n");
                        
   if( me->is_fighting() )
     return notify_fail("你无法在战斗中专心下来研读新知!\n");

        if (me->is_busy() || me->query_temp("pending/exercising"))
                return notify_fail("你现在正忙着呢。\n");

   if(!arg || !objectp(ob = present(arg, me)) )
     return notify_fail("你要读什么?\n");

   if( !mapp(skill = ob->query("skill")) )
     return notify_fail("你无法从这样东西学到任何东西。\n");

   if( !me->query_skill("literate", 1) )
     return notify_fail("你是个文盲,先学学读书识字(literate)吧。\n");

   message("vision", me->name() + "正专心地研读" + ob->name()
     + "。\n", environment(me), me);
  
        my_skill=me->query_skill(skill["name"],1);

   if( (int)me->query("combat_exp") < skill["exp_required"] ||
            ((string)SKILL_D(skill["name"])->type()=="martial"
             && my_skill*my_skill*my_skill/10>(int)me->query("combat_exp"))) {
     write("你的道行不够,再怎么读也没用。\n");
     return 1;
   }

   notify_fail("以你目前的能力,还没有办法学这个技能。\n");
   if( !SKILL_D(skill["name"])->valid_learn(me) ) return 0;

   cost = skill["sen_cost"] + skill["sen_cost"] 
     * (skill["difficulty"] - (int)me->query_int())/20;
   if( (int)me->query("sen") < cost ) {
     write("你现在过于疲倦,无法专心下来研读新知。\n");
     return 1;
   }

   if( me->query_skill(skill["name"], 1) > skill["max_skill"] ) {
     write("你研读了一会儿,但是发现上面所说的对你而言都太浅了,没有学到任何东西。\n");
     return 1;
   }

   me->receive_damage("sen", cost);

   if( !me->query_skill(skill["name"], 1) )
     me->set_skill(skill["name"], 0);
   me->improve_skill(skill["name"], (int)me->query_skill("literate", 1)/5+1);
   write("你研读有关" + to_chinese(skill["name"]) + "的技巧,似乎有点心得。\n");
   return 1;
}
コード例 #22
0
ファイル: _exits.c プロジェクト: ClockworkSoul/MortalRemains
int cmd_exits() {
   int loop;
   mapping exits;
   string short;

   if (!TP->query_vision()) {
      write("It's too dark for you to see the exits!\n");
      return 1;
   }
   
   exits = (mapping) environment(previous_object()) -> query("exits");
   
   if (!exits || !mapp(exits)) {
      notify_fail("There are no exits here, from what you can tell.\n");
      return 0;
   }
   
   write("Exits for " + bold(environment(previous_object()) -> 
         query("short")) + ":\n");
   
   for( loop = 0; loop < sizeof(keys(exits)); loop++ ) {
      if( catch(values(exits)[loop] -> XXX())) {
         if (wizardp(previous_object()))
            write("Unloadable room : " + identify(keys(exits)[loop]) +
            "\t-> " + identify(values(exits)[loop]) + "\n");
         continue;
       }
      write("  " + pad(capitalize(keys(exits)[loop]), 13) + ":   " +
         (string) values(exits)[loop] -> query("short") + "\n");
   }
   return 1;
}
コード例 #23
0
ファイル: huoji.c プロジェクト: heypnus/xkx2001
string ask_me()
{
        object obj, me = this_player();
        mapping prices;
        string *places, place;
        int price;

        if( !(obj = present("bang ling", me)) )
                return RANK_D->query_respect(me) + "不做生意,不必操心参价。";

        if( (string)obj->query("job/type") != "买卖" )
                return RANK_D->query_respect(me) + "不做生意,不必操心参价。";

        if( (string)obj->query("job/name") != "长白山人参" )
                return "我只知道参价," + RANK_D->query_respect(me) + "还是去向别人打听吧。";

        if( !mapp(prices = obj->query("job/prices")) )
                return "最近参价混乱,我不是太清楚。";

        price = 0;
        place = "city";
        places = keys(prices);
        for(int i = 0; i < sizeof(places); i++) {
                if( prices[places[i]] > price ) {
                        price = prices[places[i]];
                        place = places[i];
                }
        }

        return "听说" + region_names[place] + "一带参价最高。";
}
コード例 #24
0
ファイル: close.c プロジェクト: mudchina/fy3
int main(object me, string arg)
{
	mapping doors;
	string *dirs, dir;
	int i;

	if( !arg ) return notify_fail("你要关闭什麽?\n");

	doors = environment(me)->query_doors();
	if( mapp(doors) ) {
		dirs = keys(doors);
		if( member_array(arg, dirs)!=-1 ) dir = arg;
		else for(i=0; i<sizeof(dirs); i++)
			if( arg==doors[dirs[i]]["name"] || member_array(arg, doors[dirs[i]]["id"])!=-1 ) {
				dir = dirs[i];
				break;
			}
		if( !dir ) return notify_fail("你要关闭什麽?\n");
	
		if( environment(me)->close_door(dir) ) {
			message_vision("$N将" + doors[dir]["name"] + "关上。\n", me);
			return 1;
		}
	}

	return 0;
}
コード例 #25
0
ファイル: _in.c プロジェクト: ClockworkSoul/MortalRemains
int cmd_in(string str) {
	string room, cmd;
        mapping exits;
	object prev, act_ob,env;
	int s;

	if (!str || sscanf(str, "%s %s", room, cmd) != 2) {
		notify_fail("Usage:\tin <room|exit> <command>\n");
		return 0;
	}
	env = environment(this_player());
	act_ob = previous_object();
        if (env)
                exits = env->query("exits");
	if(!mapp(exits) || member_array(room,keys(exits)) == -1) {
	room = resolv_path((string)act_ob->query("cwd"), room);
	if (!room || ((s = strlen(room)) >= 2 &&
	      file_size( (room[s-2..s-1] == ".c") ? room : room + ".c") <= 0))
	    return 0;
	} else room = exits[room];
	prev = environment(act_ob);
	if(act_ob->move(room) == MOVE_OK) {
		act_ob->force_me(cmd);
		act_ob->move(prev);
		return 1;
	}
	write("in: could not move to target.\n");
	return 1;
}
コード例 #26
0
ファイル: skills.c プロジェクト: mudchina/fy3
int main(object me, string arg)
{
	object ob, *list, couple_ob;
	mapping skl, lrn, map;
	string *sname, *mapped,target,cardname;
	int i, marry_flag;
	int point;
	string banghui;
	int flag;

	seteuid(getuid());

	if(!arg)
		ob = me;
	else{
		ob = present(arg, environment(me));
//        if ( ob->query("SPSKILLS",1)  ) return ob->skills();		 
		if (!ob) ob = find_player(arg);
		if (!ob) ob = find_living(arg);
		if (!ob) return notify_fail("你要察看谁的技能?\n");
	}
	
	marry_flag = 0;
	list = all_inventory(me);
	i = sizeof(list);
	while (i--) {
		if ((string)list[i]->query("id") == "marrycard") {
			cardname = list[i]->query("name");
			marry_flag = 1;
		}
	}
	if (marry_flag == 1) {
		if (sscanf(cardname,"你和%s的婚约" ,target)!=1)
                	return notify_fail("你没有伴侣.\n");
		couple_ob = find_player(target);	
	}

	flag=0;
	if(!stringp(banghui=me->query("banghui")))	flag=0;
	else if((string)ob->query("banghui")!=banghui)	flag=0;
	else	flag=1;
	if( ob!=me && !wizardp(me) && !ob->is_apprentice_of(me)
	&& !me->is_apprentice_of(ob) && ob!=couple_ob 
	&& !flag
	)
	return notify_fail("只有巫师、师徒关系或同帮会才能查看他人技能。\n");
	if( ob!=me && environment(me)!=environment(ob) && !wizardp(me))
		return notify_fail("这儿没有这么个人。\n");

	skl = ob->query_skills();
	if(!sizeof(skl)) {
		write( (ob==me ? "你" : ob->name()) + "目前并没有学会任何技能。\n");
		return 1;
	}
	write( (ob==me ? "你" : ob->name()) +"目前所学过的技能:\n\n");
	sname  = sort_array( keys(skl), (: strcmp :) );
	
	map = ob->query_skill_map();
	if( mapp(map) ) mapped = values(map);
	if( !mapped ) mapped = ({});
コード例 #27
0
ファイル: apprentice.c プロジェクト: mudchina/nitan3
void assign_apprentice(string title, int privs)
{
        mapping family;

        if (! mapp(family = query("family"))) return;

        family["title"] = title;
        family["privs"] = privs;

        if (userp(this_object()) || ! query("title"))
        {
                switch (family["generation"])
                {
                case 0:
                        set("title", family["family_name"] + family["title"]);
                        break;
                case 1:
                        set("title", family["family_name"] + "开山祖师");
                        break;
                default:
                        set("title", sprintf("%s第%s代%s", family["family_name"],
                                chinese_number(family["generation"]), family["title"]));
                        break;
                }
        }
}
コード例 #28
0
void end_death(object me)
{
    	int cost;
	mapping skl, lrn, map;
	string *sname, *mapped;
    	int i;


    if( me->query_temp("death/combat_exp") )
    {
        // cost =(int) ( me->query("combat_exp") *
// int �� str �ߵ��˵�ʵս����ȽϿ�... so �۱Ƚ϶�... 5% - 10%
//       ( (random(me->query("int")*2 + me->query("str") - 30) + 60) / 12 ) /
// kar �Ƚϸߵ���.. �Ƚ��и���... ���Դ���... ���� 1 - 2....
//        ( random(me->query("kar") - 10) / 15 + 1) / 100 );
	if( !me->query("death/time") ) {
	    cost = me->query("combat_exp") / 100 * 3;
            me->add("combat_exp", -cost);
            tell_object(me, "���ʵս���鱻����"+chinese_number(cost)+"�㡣\n");
	    return;
	}

        cost = me->query("combat_exp") / 100 * 7;

        me->add("combat_exp", -cost);
	tell_object(me, "���ʵս���鱻����"+chinese_number(cost)+"�㡣\n");
    }
    if( me->query_temp("death/skill") )
    {
        skl = me->query_skills();
        if(sizeof(skl)) {
            sname  = keys(skl);
            map = me->query_skill_map();
            if( mapp(map) ) mapped = values(map);
            if( !mapped ) mapped = ({});
コード例 #29
0
ファイル: dbase.c プロジェクト: mudchina/fy4
mixed set_with_slash(string prop, mixed data)
{
        if( !mapp(dbase) ) dbase = ([]); 
        if( strsrch(prop, '.')!=-1 )
                return _set( dbase, explode(prop, "."), data ); 
        return dbase[prop] = data;
}
コード例 #30
0
ファイル: falun-gong.c プロジェクト: heypnus/xkx2001
mixed hit_ob(object me, object victim, int damage_bonus, int factor)
{
	string msg;
	int ap, dp;
        int damage, myneili, yourneili, my_max, your_max;
        string force_skill;
        mixed foo;
        string result;

	ap = me->query("combat_exp")/1000;
        ap += me->query_skill("force");
        dp = victim->query("combat_exp")/1000;
        dp += victim->query_skill("force");
        ap = (ap + random(ap*2))/2;

        msg = HIR"$N大呼酣战,口念密宗不动明王真言,运龙象之力朝$n击去!\n"NOR;

        myneili = (int)me->query("neili");
        yourneili = (int)victim->query("neili");
        my_max = (int)me->query("max_neili")*2;
        your_max = (int)victim->query("max_neili")*2;
        myneili = my_max > myneili ? myneili : my_max;
        yourneili = your_max > yourneili ? yourneili : your_max;
        me->add("neili", - factor );
        damage = myneili/20 + factor - yourneili/25;

        if( me->query_temp("longxiang") && (ap > dp) ) {
                damage *= 2;
                message_vision(msg,me,victim);
        }

        if (force_skill = victim->query_skill_mapped("force") ) {
                foo = SKILL_D(force_skill)->hit_by(me, victim, damage, damage_bonus, factor);

                if (stringp(foo)) return (string)foo;
                else if (intp(foo)) damage = (int)foo;
                else if (mapp(foo)) return foo;
        }

        if ( damage > 0 )
                damage = damage * factor / (int)me->query_skill("force") * 2;

        if( damage < 0 ) {
                if( !me->query_temp("weapon")
                && random(victim->query_skill("force")) > me->query_skill("force")/2 ) {
                        damage = - damage;
                        me->receive_damage( "qi", damage * 2, victim);
                        me->receive_wound( "qi", damage, victim );
                        if( damage < 10 ) result = "$N受到$n的内力反震,闷哼一声。\n";
                        else if( damage < 20 ) result = "$N被$n以内力反震,「嘿」地一声退了两步。\n";
                        else if( damage < 40 ) result = "$N被$n以内力一震,胸口有如受到一记重锤,连退了五六步!\n";
                        else result = "$N被$n的内力一震,眼前一黑,身子向后飞出丈许!!\n";
                        result += "( $N"+ COMBAT_D->status_msg((int)me->query("qi")*100/(int)me->query("max_qi")) + " )\n";
                        damage_bonus = -5000; // just a number negative enough
                        return ([ "result" : result, "damage" : damage_bonus ]);
                }
                if( damage_bonus + damage < 0 ) return - damage_bonus;
                return damage;
        }