示例#1
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;   
}
示例#2
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;
}
示例#3
0
文件: channel.c 项目: Elohim/FGmud
int cmd(string str) {
    string opt, who, channel;
    object ob;

    if(!str) return 0;
    if(!archp(previous_object())) return 0;

    // Attempt to remove or add a players line rights.
    if(sscanf(str, "%s %s %s", opt, who, channel) == 3) {
        if(!(ob = find_player(lower_case(who)))) 
            return notify_fail("No such player online.\n");
        if(opt == "remove") {
            if(member_array(channel, ob->GetChannels()) == -1) {
                this_player()->eventPrint(ob->GetName()
                        + " is not currently subscribed to the " + channel + " line.");
                return 1;
            }
            ob->RestrictChannel(channel);
            this_player()->eventPrint("%^RED%^You restrict " + ob->GetName()
                    + " from the " + channel + " line.%^RESET%^");
            ob->eventPrint("%^RED%^You have lost your " + channel
                    + " line rights.%^RESET%^");
            return 1;
        }
        else if(opt == "add") {
            if(member_array(channel, ob->GetRestrictedChannels()) == -1) {
                message("system", ob->GetName() + " is not currently restricted from the "
                        + channel + " line.", this_player());
                return 1;
            }
            ob->UnrestrictChannel(channel);
            this_player()->eventPrint("%^RED%^You unrestrict " + ob->GetName()
                    + " from the " + channel + " line.%^RESET%^");
            ob->eventPrint("%^RED%^You have regained your " + channel
                    + " line rights.%^RESET%^");
            return 1;
        }
    }
    // Otherwise, return restriction information, if it is requested.
    else if(str) {
        string *channels;
        string tmp;
        int size;

        if(!(ob = find_player(lower_case(str)))) 
            return notify_fail("No such player online.\n");
        channels = ob->GetRestrictedChannels();
        size = sizeof(channels);
        tmp = ob->GetName() + " is currently restricted from ";
        if(size) tmp += "the " + conjunction(channels);
        else tmp += "no";
        if(size == 1) tmp += " line.";
        else tmp += " lines.";
        this_player()->eventPrint(tmp);
        return 1;
    }
    else return 0;
}
示例#4
0
int valid_leave(object me, string dir)
{
  if (dir == "east" && 
      me->query("family/master_id") != "yu shu" &&
      member_array("tian shu",me->parse_command_id_list())==-1 &&
      member_array("yu shu",me->parse_command_id_list())==-1)
    return notify_fail("那里只有洞主的亲信才能随意出入。\n");
  return ::valid_leave(me, dir);
}
示例#5
0
void add_limb(object ob, string limb, object tp, int healing) {
     object body;
     string *all, *wieldin, minor;
     int i;

     body = new(MONSTER);
     body->move("/d/nopk/standard/void.c");
     body->set_race(ob->query_race());
     body->set_body_type(ob->query_race());
     all = body->query_limbs();
     wieldin = body->query_wielding_limbs();

     if(member_array(limb, all) == -1) { write("Not a valid limb!"); body->remove(); return; }

     i = sizeof(all);
     while(i--) {
        if(body->query_reference(all[i]) == limb) {
          if(member_array(all[i], ob->query_limbs()) == -1) {
            write("You'll need to replace the "+all[i]+" first!");
            body->remove();
            return;
            }
          minor = "YES";
          }
       }
     if(!minor) {
       if(body->query_reference(limb) != "")
         minor = body->query_reference(limb);
       else
         minor = "NO";
       }

     if(minor == "NO")
       ob->add_limb(limb, "", ob->query_max_hp()/3, 0, 0);
     else if(minor == "YES")
       ob->add_limb(limb, "", ob->query_max_hp()/4, 0, 0);
     else
       ob->add_limb(limb, minor, ob->query_max_hp()/3, 0, 0);

     if(member_array(limb, wieldin) != -1)
       ob->add_wielding_limb(limb);

     if(tp==ob) {
       write("Your "+limb+" regenerates through prayer!");
       say(tp->query_cap_name()+"'s "+limb+" regenerates through prayer!", tp);
       tp->add_skill_points("healing", random(healing/2)*2);
       tp->add_exp(random(healing/2)*2);
       }

     else {
       write("You regenerate "+ob->query_cap_name()+"'s "+limb+" through prayer!\n");
       tell_object(ob, tp->query_cap_name()+" regenerates your "+limb+" through prayer!\n");
       tell_room(environment(tp), tp->query_cap_name()+" says a prayer that regenerates "+ob->query_cap_name()+"'s "+limb+".\n", ({ tp, ob }) );
       tp->add_skill_points("healing", healing);
       tp->add_exp(healing);
       tp->add_alignment(healing);
       }
示例#6
0
文件: _pounce.c 项目: ehershey/pd
int cmd_pounce(string str) {
  object victim;
  int i, tmp;

  if (!abil()) 
    return notify_fail("What?\n");

  if(!str)
    return notify_fail("Pounce whom?\n");

  if (this_player()->query_rest_type())
    return notify_fail("You are not in a position to perform that action\n");

  if(this_player()->query_ghost())
    return notify_fail("You appear to be dead.\n");

  if(this_player()->query_busy()) return notify_fail("You are busy.");

  if(environment(this_player())->query_property("no attack"))
    return notify_fail("Some mystical force prevents you from that.\n");

  if(this_player()->query_sp() < 25)
    return notify_fail("You are too tired to pounce on your victim.\n");

  if(!(victim = present(lower_case(str),environment(this_player())))) 
    return notify_fail("You do not see that here.\n");

  if(victim == this_player())
    return notify_fail("Pounce on yourself?\n");

  if(!living(victim))
    return notify_fail("You can not pounce on that.\n");

  if(member_array(victim, (object *)this_player()->query_hunted()) != -1 ||
   member_array(victim, (object *)this_player()->query_attackers())!=-1) {
    return notify_fail("You have lost the element of surprise!\n");
  }

  if(this_player()->query_current_attacker())
    return notify_fail("You are already in combat with something else!\n");

  if(victim->is_player() && !interactive(victim)) return 0;

  if (victim->query_skill("perception") + victim->query_stats("wisdom") >
   this_player()->query_skill("nature"))
    tell_object(victim, ""+this_player()->query_cap_name()+" attempts to sneak behind you unnoticed!");

  this_player()->set_paralyzed(1,"You are concentrating on your meal.");

  call_out("do_dmg", 1, victim, this_player());

  write("You sneak around behind "+victim->query_cap_name()+"!");

  return 1;
}
示例#7
0
int regenerate(string limb) {
    int money, bonus;
    mapping limb_info;
    object tp;
    string *there, *missing;

    tp = this_player();
    if(present(limb, this_player())) bonus = 2;
    else bonus = 1;
    there = (string *)tp->query_limbs();
    missing = (string *)this_player()->query_severed_limbs() +
      (string *)RACE_D->query_limbs((string)this_player()->query("race"));
/*
   checking with the race_d is allowing compatibility with old
   versions of the mudlib
*/
    if(!missing) {
        notify_fail("You aren't missing any limbs!\n");
        return 0;
    }
    if(member_array(limb, missing) == -1) {
        notify_fail("You are not missing that limb!\n");
        return 0;
    }
    if(member_array(limb, there) != -1) {
        notify_fail("You already have that one back!\n");
        return 0;
    }
    limb_info= (mapping)RACE_D->query_limb_info(limb,(string)tp->query("race"));
    if(!limb_info) {
        notify_fail("That limb cannot be replaced!\n");
        return 0;
    }
    if(limb_info["attach"] != "0") {
        if(member_array(limb_info["attach"], there) == -1) {
            notify_fail("You would need a "+limb_info["attach"]+" for that!\n");
            return 0;
        }
    }
    if((string)this_player()->query_class() == "cleric") money = 1200;
    else money = 1600;
    money = money / limb_info["max"];
    if((int)tp->query_money("gold") < COST) {
        notify_fail("The cleric tells you:  You do not have enough gold.\n");
        return 0;
    }
    tp->add_limb(limb, limb_info["ref"], (int)tp->query_max_hp()/limb_info["max"], 0, 0);
    if(member_array(limb, (string *)RACE_D->query_wielding_limbs((string)tp->query("race"))) != -1) 
        tp->add_wielding_limb(limb);
    this_player()->add_money("gold", -COST);
    say(sprintf("%s asks the clerics for some help with %s missing %s.",
      this_player()->query_cap_name(), possessive(this_player()), limb));
    write("The clerics restore your "+limb+"!");
    return 1;
}
int can_train (string skill) {
// If trainable_skills is not set, or is set to "ALL", then we can train it.
	if (!trainable_skills) return 1 ;
   if (member_array(skill, trainable_skills) != -1 &&
       (int)TP->query_skill(skill)>MAX_TRAINING) return -1 ;
	if (trainable_skills=="ALL") return 1 ;
// If it is not a member of trainable_skills, we cannot train it.
	if (member_array(skill,trainable_skills)==-1) return 0 ;
// It is a member of trainable skills, so we can train in it.
	return 1 ;
}
示例#9
0
int valid_leave(object me, string dir)
{
  if (dir == "north" && 
      member_array("tian shu",me->parse_command_id_list())==-1 &&
      member_array("yu shu",me->parse_command_id_list())==-1 &&
      me->query("family/family_name") != "陷空山无底洞" &&
      objectp(present("hudian yao", environment(me))))
    {
      message_vision(CYN"护殿妖喝道:呔!何方妖人,胆敢擅闯禁地!\n"NOR, me);
      return notify_fail("");
    }
  return ::valid_leave(me, dir);
}
示例#10
0
文件: ping.c 项目: huangleon/fy2005
int check_legit(object ob) {
	object me, *team, owner;
	me=this_player();
	
	if (ob==me) return 1;
	team=me->query_team();
	if (team) {
		if (member_array(ob,team)!=-1) return 1;
		if (owner=ob->query("possessed"))
		if (member_array(owner,team)!=-1) return 1;
	}
	return 0;
}
示例#11
0
文件: tbg.cpp 项目: TeoTwawki/dltcep
int Ctbg::collect_spellrefs()
{
  int *strref_opcodes;
  int pos;
  int count;
  int i;

  strref_opcodes=get_strref_opcodes();
  pos=0;
  count=4; //item header contains 4 strrefs
  for(i=0;i<the_spell.featblkcount;i++)//not header, we need ALL feature blocks
  {
    if(member_array(the_spell.featblocks[i].feature,strref_opcodes)!=-1)
    {
      count++;
    }
  }
  tlkentries=new tbg_tlk_reference[count];
  if(!tlkentries) return -3;
  tlkentrycount=count;        //physical size
  strrefs=new unsigned long[count];
  if(!strrefs)
  {
    delete [] tlkentries;
    return -3;
  }
  strrefcount=count;

  strrefs[pos]=calc_offset(the_spell.header, desc);
  if(!resolve_tbg_entry(the_spell.header.desc,tlkentries[pos])) pos++;
  strrefs[pos]=calc_offset(the_spell.header, spellname);
  if(!resolve_tbg_entry(the_spell.header.spellname,tlkentries[pos])) pos++;
//  strrefs[pos]=calc_offset(the_spell.header, unknown4c);
//  if(!resolve_tbg_entry(the_spell.header.unknown4c,tlkentries[pos])) pos++;
  strrefs[pos]=calc_offset(the_spell.header, idname);
  if(!resolve_tbg_entry(the_spell.header.idname,tlkentries[pos])) pos++;

  for(i=0;i<the_spell.featblkcount;i++)
  {
    if(member_array(the_spell.featblocks[i].feature,strref_opcodes)!=-1)
    {
      strrefs[pos]=the_spell.header.featureoffs+calc_offset2(the_spell.featblocks[0],the_spell.featblocks[i].par1.parl);
      resolve_tbg_entry(the_spell.featblocks[i].par1.parl,tlkentries[pos++]);
    }
  }
  header.tlkentrycount=pos;   //logical size
  header.strrefcount=pos;
  return 0;
}
示例#12
0
int member_map( mixed item, mapping map ) {
  mixed *arr;

  argcheck( map, 2, "mapping" );

  arr = map_indices( map );
  if( member_array( item, arr ) > -1 )
    return( 1 );
  arr = map_values( map );
  if( member_array( item, arr ) > -1 )
    return( 1 );

  return( 0 );

}
示例#13
0
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
string create_help(string str) {
  int i;
  mixed cross_ref;

  for (i=0;i<sizeof(help_dirs);i++)
    if (file_size(help_dirs[i]+str)>0) {
      NROFF_HAND->create_help(help_dirs[i], str);
      return NROFF_DIR+str;
      return help_dirs[i]+str;
    }
  if (this_player()->query_creator())
    for (i=0;i<sizeof(creator_dirs);i++)
      if (file_size(creator_dirs[i]+str)>0) {
        NROFF_HAND->create_chelp(creator_dirs[i], str);
        return CNROFF_DIR+str;
        return creator_dirs[i]+str;
      }

  cross_ref = read_file("/doc/cross_ref");
  cross_ref = explode(cross_ref, "%");
  if ((i=member_array(str,cross_ref))==-1)
    return 0;
  return extract(cross_ref[i+1],0,strlen(cross_ref[i+1])-2);
    /* use extract, not explode */
} /* create_help() */
示例#15
0
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;
}
示例#16
0
mixed *query_auto_load() {
       if(member_array("Order of the Screaming Pelicans",(this_player()->query_quests())) == -1)
           { return 0;}
       else
         {
       return ({ARMOR1+"sp_signet.c",({}) });
       }
示例#17
0
int extra_worn() {
        object tp;
        tp=this_player();

     if(member_array("Order of the Screaming Pelicans",(tp->query_quests())) ==  -1)
         {
           this_object()->remove();
            message("info","You have not honored the %^RED%^Screaming Pelicans%^RESET%^ by completing their quest\n\nThe signet %^MAGENTA%^EXPLODES%^RESET%^ in your hand!",tp);
            message("info","\n\nThe signet of the %^RED%^Screaming Pelicans%^RESET%^ explodes in "+(tp->query_cap_name())+"'s hand\n\n",environment(tp),tp);
           return 0;
              }
     else if( (tp->query("screamingpelican"))==0) {

        tp->set("screamingpelican",1);
         message("info","Your %^BOLD%^aura%^RESET%^ glows under the power of the %^RED%^%^BOLD%^Screaming Pelicans%^RESET%^\nYou feel totally %^ORANGE%^energized%^RESET%^",tp);
         message("info",(tp->query_cap_name())+" glows under the enchantments of the '%^RED%^BOLD%^Screaming Pelicans%^RESET%^'. They look totally energized",environment(tp),tp);
         return 1;
         }
      else
          {
           message("info","Wearing two of this ring would nullify the effect.\n",tp);
           return 0;
            }

    }
示例#18
0
文件: adsd.c 项目: heypnus/xkx2001
void update_ads_phase()
{
	int i;
	int ads_count = 0;
	object* all;
	
	remove_call_out("update_ads_phase");
	
	if(current_ads_phase==0) 
	{
       		init_ads_phase();
   	}

	current_ads_phase = (++current_ads_phase) % sizeof(ads_phase);
	
	message("channel:ads", "【广告】" + ads_phase[current_ads_phase]["time_msg"] + "\n", users());
	
	all = users();
	for(i=0;i<sizeof(all);i++) {
		if( member_array("ads", all[i]->query("channels"))==-1 ) continue;
		else ads_count++;
	}
	
	if(ads_count >=1) {
	//	message( "channel:wiz", sprintf("【巫师】%d 个玩家接收此广告。\n", ads_count), users());
		log_file("ADS", sprintf("[%s] \"" + ads_phase[current_ads_phase]["time_msg"] + "\" 被 [%d] 个玩家接收\n", 
		ctime(time()),	ads_count));
	}

	this_object()->event_common();

       	call_out("update_ads_phase", ads_phase[current_ads_phase]["length"]);
}
示例#19
0
void init ()
{
  object	mbox;
  string	id;
  string	*f;

  id = this_player()->query("id");
  f = this_object()->query("friends");

  if (id == "wade") {
    add_action("setf", "setf");
    add_action("delf", "delf");
    add_action("do_save", "sr");
  }
  else if ( !f || member_array(id, f) == -1 )
  {
    write ("啊, 这里不欢迎不请自来的耶!\n");
    this_player()->move("/open/center/room/inn");
    return;
  }

  seteuid(getuid());

  // 处理信箱.
  if( !this_player()->query_temp("mbox_ob") ) {
    mbox = new(MAILBOX_OB);
    if (mbox->move(this_player()))
      write ("为了您的方便, 面包发给您一张快递单.\n");
  }
  add_action ("do_home", "home");
  add_action ("do_home", "goto");
}
示例#20
0
int
do_delete( string quest )
{
    string	*quests;

    quests = (mixed*) QUEST_HANDLER->query_quest_names();

    if ( quest )
    {
	if ( !member_array( quest , quests ) )
	{
	    write( "Quest not found.\n" );
	    return 1;
	}
	old_quest = quest;

	write( "\nYou should not remove someone else's quest!!!\n\n"
	     + "Are your sure you want to remove this quest? (y/n) > " );
	input_to( "remove_quest" );
	return 1;
    }
    write( "Syntax: remove <quest>, where <quest> is the name of an "
	 + "existing quest.\n" );
    return 1;
}
int cmd(string arg, mixed thing, int silent) {
  class message mess;
  string words,
    word;
  string them_mess,
    extra;
  string *ok_string;
  string *prop;
  object *obs;
  object *net_dead;
  object *multiple_earmuffed;
  object *cannot_see;
  object *ok;
  object *fail;
  object *earmuffed;           /* These people have ear muffed tells */
  object *roleplaying;
  mixed busy;
  
  if (pointerp(thing)) {
    words = arg;
    thing -= ({ 0 });
    if (TP && environment(TP) &&
        function_exists("trap_tell", environment(TP)) &&
        member_array(this_object(), previous_object(-1)) == -1) {
      return (int) environment(TP)->trap_tell(words, thing, 0);
    }
  } else if (!objectp(thing)) {
示例#22
0
int valid_leave(object me, string dir)
{
  if (dir == "north" && 
      member_array("hu xianfeng",me->parse_command_id_list())==-1)
    return notify_fail("你以为谁都可以随便出入后园吗?\n");
  return ::valid_leave(me, dir);
}
示例#23
0
文件: _ignore.c 项目: ehershey/pd
int cmd_ignore(string str) {
  string *list, total;
  if(!str) {
    list = this_player()->query_full_ignore();
    if(sizeof(list) < 1) {
      write("You are not ignoring anyone.");
      return 1;
    }
    write("%^BLUE%^+=+=%^BOLD%^( %^WHITE%^Ignored %^BLUE%^)%^RESET%^%^BLUE%^=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=%^RESET%^\n");
    total = "   "+capitalize(list[0]);
    if(sizeof(list) > 1)
      for(int i=1; i < sizeof(list); i++)
        total += ", "+capitalize(list[i]);
    write(total);
    return 1;
  }
  str = lower_case(str);
  if(member_array(str, IMMS) != -1) return 1;
  if(this_player()->query_ignoring(str)) {
    this_player()->change_ignore(str);
    write("You are no longer ignoring "+capitalize(str)+".");
  }
  else {
    this_player()->change_ignore(str);
    write("You are now ignoring "+capitalize(str)+".");
  }
  return 1;
}
示例#24
0
文件: support.c 项目: xxx/cdlib
/*
 * support_q
 */
int support_q(mapping p)
{
    if (strlen(p["PORTUDP"]) && strlen(p["ANSWERID"]))
    {
	if (member_array(p["CMD"], UDP_SUPPORT_ARRAY) < 0 ||
	    ((strlen(p["PARAM"]) &&
	      !call_other(TO, "support_" + p["CMD"], p["PARAM"]))))
	{
	    TO->send_udp(p["HOSTADDRESS"], atoi(p["PORTUDP"]), 
			 "@@@" + UDP_SUPPORTED_A +
			 "||NAME:" + TO->query_my_name() +
			 "||PORTUDP:" + TO->query_my_udpport() +
			 "||CMD:" + p["CMD"] +
			 (strlen(p["PARAM"]) ? "||PARAM:" + p["PARAM"] : "") +
			 "||NOTSUPPORTED:yes" +
			 "||ANSWERID:" + p["ANSWERID"] +
			 "@@@\n");
	}
	else
	{
	    TO->send_udp(p["HOSTADDRESS"], atoi(p["PORTUDP"]), 
			 "@@@" + UDP_SUPPORTED_A +
			 "||NAME:" + TO->query_my_name() +
			 "||PORTUDP:" + TO->query_my_udpport() +
			 "||CMD:" + p["CMD"] +
			 (strlen(p["PARAM"]) ? "||PARAM:" + p["PARAM"] : "") +
			 "||SUPPORTED:yes" +
			 "||ANSWERID:" + p["ANSWERID"] +
			 "@@@\n");
	}
	return 1;
    }
    return 0;
}
示例#25
0
int main(object me, string arg)
{
	mixed *dir;
	string *id;
	mapping data;
	object lingpai;
	string msg,banghui;
	int i;
	if(! arg)	{
	dir=get_dir("/data/guild/",0);
	if(! dir)	return notify_fail("朕念短嗤販採逸氏。\n");
	msg=sprintf("%-16s%-10s%-10s%-10s%-10s\n",
		"逸氏兆各","逸麼","螺社方","NPC方","仇徒方");
	msg+="------------------------------------------------------------\n";
	lingpai=new("/obj/lingpai");
	for(i=0;i<sizeof(dir);i++)	{
		if(sscanf(dir[i],"%s.o",banghui)==1)	{
			lingpai->create(banghui);
//			msg+=sprintf("%-16s%-10s%-10d%-10d%-10d\n",
			msg+=sprintf("%s%-16s%-10s%-10d%-10d%-10d"NOR"\n",
			member_array(banghui,npc_banghui)!=-1?HIG:"",
			banghui,lingpai->query("bangzhu"),sizeof(lingpai->query("player")),sizeof(lingpai->query("npc")),sizeof(lingpai->query("area")));
	}
	}
	destruct(lingpai);
	}
示例#26
0
文件: message.c 项目: mudchina/fy2
void receive_message(string msgclass, string msg)
{
	string subclass, *ch;

	if( !interactive(this_object()) ) {
		this_object()->relay_message(msgclass, 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;
				break;
			case "outdoor":
				if( !environment() || !environment()->query("outdoors") )
					return;
				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()) ) {
		if( sizeof(msg_buffer) < MAX_MSG_BUFFER )
			msg_buffer += ({ msg });
	} else
示例#27
0
文件: var.c 项目: arylwen/terebi
int CheckVar(string var, object ob){
    mixed *vars;
    if(!var || !ob) return 0;
    vars = variables(ob);
    if(member_array(var, vars) == -1) return 0;
    return 1;
}
示例#28
0
文件: types.c 项目: Elohim/FGmud
varargs int cmd(string str){
    int err, i;
    string s1, s2;
    string file = "/open/typecheck.c";
    mixed ret, tmpret;
    if(!str){
        write("Try: help types");
        return 1;
    }
    i = sscanf(str,"%s %s", s1, s2);
    if(i != 2 || member_array(s1, types) == -1){
        write("Try: help types");
        return 1;
    }
    contents = header+program;
    contents = replace_string(contents,"$S",s2);
    unguarded((: write_file($(file), contents,1) :));
    reload(file,0,1);
    err = catch( tmpret = file->typecheck() );
    if(err || (stringp(tmpret) && !strsrch(tmpret,"DEFINED_D:"))){
        write("\n"+ tmpret +" appears to be an invalid integer value.");
        return 1;
    }
    else ret = TYPES_D->eventCalculateTypes(s1, tmpret);
    if(arrayp(ret)) ret = implode(ret," ");
    write("The value "+tmpret+" for "+s1+" is: "+ret);
    return 1;
}
示例#29
0
文件: consolidate.c 项目: ehershey/pd
string consolidate(int x, string str) {
    string tmp, atmp;
    string *words;
    int i, y;

    if(x==1 || !str || str == "") return str;
    i = sizeof(words = explode(str, " "));
    if (words[i-1][0]=='(')
     {
      atmp = words[i-1];
      words[i-1]="";
      i -=1;
     }

    if((tmp = lower_case(words[0])) == "a" || tmp == "an" || tmp =="the")
      i = sizeof(words = words[1..i-1]);
    if((y=member_array("of", words))  > 0)
        words[y-1] = pluralize(words[y-1]);
    else words[i-1] =  pluralize(words[i-1]);
    tmp = cardinal(x)+" ";

if (atmp)
     return tmp+implode(words, " ")+" "+atmp;
   return tmp+implode(words, " ");
}
示例#30
0
int valid_leave(object me, string dir)
{
	int count;

	if (member_array(dir, dirs) != -1)
	{
		if (dir == "east")
		{
//			write("*水生木*\n");
			count = me->query_temp("wuxing/木");
			count++;
			me->set_temp("wuxing/木", count);
			if (check_out(me))
				return notify_fail("你顺利地走出了五行迷宫。\n");
		}
		else if (dir == "north")
		{
//			write("*水克火*\n");
			me->delete_temp("wuxing");
			me->move(__DIR__"jianyu1");
			return notify_fail("你掉进机关,落入僧监。\n");
		}
	}
	return ::valid_leave(me, dir);
}