Пример #1
0
int do_nianxiang ()
{
  object who = this_player();
  int size = sizeof(msgs);
  int i = who->query_temp("obstacle/fengxian_nianxiang");
  int j;

  if (who->is_busy())
    return notify_fail ("你正忙着呢!\n");

  if (interactive (who) &&
      who->query("combat_exp") < 10000)
    return notify_fail ("你的道行怕是不够吧!\n");

  if (interactive(who))
    message_vision ("$N俯身低首。\n",who);

  if (! interactive(who))
    message_vision ("$N取过一根香将其点燃,诚心拈香。\n",who);
  else if (i >= size)
  {
    message_vision ("\n祭官赶紧将$N扶起。\n",who); 
  }  
  else
  {
    j = i*18+10;
    who->start_busy (j,j);
    call_out ("start_nianxiang",5,who,i);
    call_out ("finish_nianxiang",j,who,i);
  }
  return 1;
}
Пример #2
0
int clean_up()
{
	object *inv;
	int i;

	if( !clonep() && this_object()->query("no_clean_up") )
		return 1;

	if( interactive(this_object()))
		return 1;

	// by babe
	// 若此物件已被其他物件所包含, 就不再重复 clean_up, 以节省时间
	// 请勿再 environment()->query("no_clean_up");
	if(environment())
		return 1;

	inv = all_inventory();
	for( i=sizeof(inv)-1; i>=0; i-- )
		if(interactive(inv[i]))
			return 1;

	destruct(this_object());

	return 0;
}
Пример #3
0
int check_status() {

   remove_call_out("check_status");
 
   if(interactive(this_object()) || !body_ob || !interactive(body_ob))
	remove();

return 1; }
Пример #4
0
/** start the analyze with the loaded sem. net */
void MainGui::analyze() {
  try {
    if (!semNet.rootNode() || (semNet.rootNode())->children().isEmpty()) {
      receiveMessage("No semantic net defined");
      qDebug("Start analyze - no semantic net, nothing to do");
      return;
    }
#ifdef DEBUGMSG
  	qDebug("Start analyze (mode: %d)", mode_);
#endif
    treeEditor->disconnectSlots();
    sceneViewer->disconnectSlots();
    sceneViewer->rootNode(0);
    trashViewer->disconnectSlots();
    trashViewer->rootNode(0);
    propertyEditor->setNode(0,0);
    sceneAttributes->setNode(0,0);
    trashAttributes->setNode(0,0);

    mapViewer->set(0,0);
   	if (analysis_) delete analysis_;
   	else {
    	if (iNode_) delete iNode_;
    	if (map_) delete map_;
    }
    analysis_=0;
    iNode_=0;
    map_=0;
  	interactive(TRUE);//enable some analysis buttons
  	readyToAna(FALSE);  //disable some analysis buttons
  	analysis_ = new Analysis(&semNet, &geoImageList_,&labelImageList_); //set the semantic net GeoImageList
  	connect(analysis_,SIGNAL(message(QString)),this,SLOT(receiveMessage(QString)));
  	connect(analysis_,SIGNAL(sigMapView(INode*,GeoImage*)),mapViewer,SLOT(set(INode*,GeoImage*)));
  	connect(analysis_,SIGNAL(sigInteractive(bool)),this,SLOT(slotInteractive(bool)));
  	opMode(mode_);
    if (no_map_)
      analysis_->map_mode(TRUE);

  	connect(analysis_, SIGNAL(sigReady(INode*,GeoImage*)), this, SLOT(slotAnalysisReady(INode*,GeoImage*)) );
    connect(analysis_, SIGNAL(sigNodeChange(INode*)), this, SLOT(slotNodeChange(INode*)) );

    if (batchmode_)
  	  connect(analysis_, SIGNAL(sigReady(INode*,GeoImage*)), qApp , SLOT (quit()) );

	//	start analysis
  	analysis_->start();	
  	emit interactive(FALSE);//disable some analysis buttons
  	emit readyToAna(TRUE);  //enable some analysis buttons
  }
  catch (FatalError err) {
  	emit interactive(FALSE);//disable some analysis buttons
  	emit readyToAna(TRUE);  //enable some analysis buttons
  	receiveMessage(err.message());
  }
}
Пример #5
0
Файл: ftell.c Проект: cosin/XYJ
string remote_tell(string cname, string from, string mud, string to, string msg)
{
	object ob;

	if( ob = find_player(to) ) {
	        if(wizardp(ob) && ob->query("env/invisibility"))
		  return "现在找不到这个人。"; //respond no such user.

	        if( ob->query("env/block_tell") ) return
		  ob->query("name")+"现在不想和任何人说话。";

        if(!living(ob) || !interactive(ob)) 
	          return ob->query("name")+"现在听不见你说的话。\n";

		if( cname )
			tell_object(ob, sprintf(HIG "%s(%[email protected]%s)告诉你:%s\n" NOR,
				cname, capitalize(from), mud, msg ));
		else
			tell_object(ob, sprintf(HIG "%[email protected]%s 告诉你:%s\n" NOR,
				capitalize(from), mud, msg ));
		ob->set_temp("reply", from + "@" + mud);
		return ob->query("name")+"收到了你的消息。";  
		// if succeed, return target's name.
	} else
		return "现在找不到这个人。";
}
Пример #6
0
void init()
{
    if(interactive(this_player())){
          remove_call_out("run");
          call_out("run", 20+random(30), this_player());
    }
}
Пример #7
0
Файл: ftell.c Проект: cosin/XYJ
int main(object me, string arg)
{
	string target, msg, mud, filename;
	object obj;

	if( !arg || sscanf(arg, "%s %s", target, filename)!=2 )
	   return help(me);

	msg = "\n";
	msg += read_file(filename);

	if( sscanf(target, "%[email protected]%s", target, mud)==2 ) {
		GTELL->send_gtell(mud, target, me, msg);
		write("网路讯息已送出,可能要稍候才能得到回应。\n");
		return 1;
	}

        if(!block_tell(me)) return 1;

	obj = find_player(target);
	if(!obj || !me->visible(obj)) return notify_fail("没有这个人。\n");

	if( !wizardp(me) && obj->query("env/block_tell") )
	   return notify_fail(obj->name(1) + "眼下不想跟任何人说话。\n");

        if(!living(obj) || !interactive(obj)) 
	  return notify_fail(obj->name(1)+"现在听不见你说的话。\n");
	  
	write(GRN "你告诉" + obj->name(1) + ":" + msg + "\n" NOR);
	tell_object(obj, sprintf( GRN "%s告诉你:%s\n" NOR,
		me->name(1)+"("+me->query("id")+")", msg));

	obj->set_temp("reply", me->query("id"));
	return 1;
}
Пример #8
0
int valid_leave (object who, string dir)
{
  if ((! interactive(who)) &&
      dir == "south")
    return 0;
  return ::valid_leave(who,dir);
}
Пример #9
0
void init()
{
        object me;
        me = this_player();
        if(interactive(me))
        me->set_temp("intime", time()); 
} 
Пример #10
0
int valid_leave (object who, string dir)
{
  if (! interactive (who) &&
      dir == "west")
    return 0;
  return 1;
}
Пример #11
0
int switch_body() {

   if((geteuid(previous_object()) != ROOT_UID && 
       previous_object() != body_ob) || !tmp_body)  return 0;
 
   if(interactive(tmp_body) || !interactive(body_ob) ||
      !exec(tmp_body, body_ob))  return 0;
 
   body_ob = tmp_body;
   export_uid(body_ob);
   tmp_body = 0;
 
   body_ob->set_link(this_object());
   body_ob->restore_body();

return 1; }
Пример #12
0
void init ()
{
  object who = this_player();

  if (who && interactive(who))
    call_out ("appearing", 3+random(3),who);
}
Пример #13
0
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
int main(){
 
	while( 0 == 0 ) {
		printMenu();
		printf("Enter command: ");
		
		scanf("%s", choice);

		if (choice[0]=='i'){
			interactive();
		}
		else if (choice[0]=='a'){
			automatic();		
		}
		else if (choice[0]=='e'){
			printf("exiting\n\n");
			break;
		}
		else
			printf("Please enter a valid option\n");
		
		if (status == 1){ //only print the final addresses if everything has gone accordingly
			printAddress();
			status=0; //reset status
		}
	}
	return EXIT_SUCCESS;
}
Пример #15
0
static grub_err_t
grub_cmd_lua (grub_command_t cmd __attribute__ ((unused)),
	      int argc, char **args)
{
  if (argc == 1)
    {
      if (luaL_loadfile (state, args[0]))
	{
	  handle_lua_error ("Lua");
	}
      else if (lua_pcall (state, 0, 0, 0))
	{
	  handle_lua_error ("Lua");
	}
    }
  else if (argc == 0)
    {
      return interactive ();
    }
  else
    {
      return grub_error (GRUB_ERR_BAD_ARGUMENT, "1 or 0 arguments expected");
    }

  return grub_errno;
}
Пример #16
0
int cmd_renew( string a ) {
 
  object ob, new_ob, env;
  string name, file;
  int clone_number;

  seteuid( getuid( previous_object() ) );
  if( !a ) { notify_fail( SYNTAX ); return 0; }
 
// First find your object
 
   ob = get_object(a);
   
   if(!ob) {
   notify_fail("Renew: Could not locate " + a + "\n");
   return 0;  }
 
   if( interactive(ob) ) {
   notify_fail("Renew: You cannot renew an interactive object.\n");
   return 0;  }
 
   env = environment( ob );
 
// Second decide if it has been loaded or cloned
 
   name = file_name( ob );
   if( 2 != sscanf( name , "%s#%d", file, clone_number ) ) file = name;
 
// Third update it
 
   catch( this_player()-> force_me( "update " + file ) );
Пример #17
0
string query_ident(object who)
{
  string name, ipno, id;
  mixed info;
  if(!interactive(who)) return 0;
  name = (string)who->query_real_name();
  ipno = query_ip_number(who);

  if(stringp(info=ident_info[id=name+"@"+ipno])) return info;

  if(info + RETRY_TIME < time() && requests[id] < MAX_RETRIES)
  {
    reqno++;
    info=reqno +" "+query_ip_port(who)+" "+ipno;
    if((info=socket_write(sd, info, IDENTSERVER)) < 0)
    {
      _syslog("identd: socket_write failed: " + info);
      return 0;
    }

    ident_info[id]=time();
    requests[id]++;
    requests[reqno]=id;
  }
  return 0;
}
Пример #18
0
int do_update(string str)
{
   int i;
   object *all;
   all = all_inventory(this_object());
   // if(!stringp(str) || str == "here")
   // {
      // load destinations
      CODER_COMMON_ROOM->BAH();
      ENTRY_POS->BAH();

      for(i = 0; i < sizeof(all); i++)
         if(interactive(all[i])) 
         {
            if(!all[i]->query_creator())
            {
               tell_object(all[i], "Sacándote del infierno...\n");
               all[i]->move(ENTRY_POS);
               all[i]->do_look();
            }

            if(all[i]->query_creator())
            {
               tell_object(all[i],"Viajando hasta la habitación común...\n");
               all[i]->move(CODER_COMMON_ROOM);
               all[i]->do_look();
               tell_room(find_object(CODER_COMMON_ROOM), all[i]->query_cap_name()+
                  " llega con cara de cansancio... \n", all[i]);
            }
         }
         else
            all[i]->dest_me();     // dest those NPCs and items
   // }
   return 1; 
}
Пример #19
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";
}
Пример #20
0
int
main(int argc, char *argv[]) {

  checkArgs(argc, argv);

  GetTime(); 

  inputProfile();

  if (makeRP)
    MakeRegionProfile();
  if (makeSP)
    MakeStackProfile();
  if (makeObjP)
    MakeObjectProfile(regionNo);
  if (printProfile)
    PrintProfile();
  if (printRegion) 
    PrintRegion(regionNo2);
  if (printSomeStat)
    PrintSomeStat();
  if (findPrgPoint)
    FindProgramPoint(prgPoint);
  if (interact)
    interactive();
  return EXIT_SUCCESS;
}
Пример #21
0
int main(object me, string arg)
{
	object ob;
        me=this_player();
	seteuid(geteuid(me));
	if( !arg ) {
	  	if( objectp(ob = query_snooping(me)) )
			write("你现在正在监听" + ob->query("name") + "所收到的讯息。\n");
		return 1;
	} else if( arg=="none" ) {
		if( objectp(ob = query_snooping(me)))
        	message_vision (HIW + "$N停止监听$n所收到的讯息。\n"+ NOR,me,ob);
		snoop(me,);
		write("Ok.\n");
		return 1;
	}

	ob = find_player(arg);
	if (!ob) ob = find_player(arg);
	if(!ob || (!ob->visible(ob))) return notify_fail("没有这个人。\n");
        if (!interactive(ob))
           return notify_fail("不能监听断线中的使用者所收到的讯息。\n");
	if(wizhood(ob)=="(admin)"||wizhood(ob)=="(manager)")
		return notify_fail("你不能窃听大神。\n");
	if( me==ob ) return notify_fail("请用 snoop none 解除监听。\n");
		
	snoop(me, ob);
	if( userp(ob) ) log_file("SNOOP_PLAYER",
		sprintf("%s(%s) snoops %s on %s.\n", me->name(1), geteuid(me), ob->name(1),
			ctime(time()) ) );
	write (HIW"你开始监听"+ob->name()+"所收到的讯息。\n" + NOR);
	tell_object(ob, HIW + me->name(1) + "开始监听你所收到的讯息。\n" + NOR);

	return 1;
}
Пример #22
0
void init()
{
	object me, ob;
	ob = this_player();
	me = this_object();
	
	::init();

	if ( interactive(ob) && !environment(ob)->query("no_fight") )
	{
		if ( ob->query("guilty") == 1 )
		{
			if ( random(2) ==1 )
			command("say 你这佛门败类,哪里逃! 还不速到戒律院领罪!\n");
			me->set_leader(ob);
			remove_call_out("fight_ob");
			call_out("fight_ob", 1, ob); 
		}       
		if ( ob->query("guilty") >= 2 )
		{
			if ( random(2) ==1 )
			command("say 戒律院玄痛大师请你去陈述此次下山经过 !\n");
			me->set_leader(ob);
		}       
	}
	else if( environment(ob)->query("no_fight") ) me->set_leader(0);
}
Пример #23
0
void init()
{       object ob;
        object jade;
        int water, food, bellicosity;
        string outexit;
   if( interactive( ob = this_player()))
        {
        water = ob->query("water");
        food = ob->query("food");
        bellicosity = ob->query("bellicosity");
        water -= (random(4)+ 1) * water / 10;
        food -= (random(2)+ 1) * water / 10;
        bellicosity += random(10);
        ob->set("water", water);
        ob->set("food", food);
        ob->set("bellicosity", bellicosity);    
        if( !objectp(jade = present("jade", ob)))
        {
                if( random(200)< 2)               drop_him(ob);
        }
        else
        {
                if( random(1000)< 2)    drop_him(ob);
        }
        }
        add_action("do_pull", "pull");
}
Пример #24
0
int valid_leave (object who, string dir)
{
  object king = present("guo wang",this_object());

  if (king)
    return ::valid_leave (who, dir);
  if (! interactive (who) &&
      who->query("people") == "people" &&
      dir == "north")
    return 0;
  if (interactive (who)  &&
      dir == "north" &&
      ! who->query_temp("obstacle/tianzhu_thrown"))
    return notify_fail ("皇宫伺卫将枪一横,威严地喝了一声:禁行!\n");
  return ::valid_leave (who, dir);
}
Пример #25
0
int main(object me, string arg)
{
	string target, mud;
	object obj;

        if(!block_tell(me)) return 1;

	if( !arg || arg=="" )
		return notify_fail("你要回答什么?\n");

	if( !stringp(target = me->query_temp("reply")) )
		return notify_fail("刚才没有人和你说过话。\n");

	if( sscanf(target, "%[email protected]%s", target, mud)==2 ) {
		GTELL->send_gtell(lower_case(mud), lower_case(target), me, arg);
		write("网路讯息已送出,可能要稍候才能得到回应。\n");
		return 1;
	}

	obj = find_player(target);
	if( !obj ) return notify_fail(
	  "刚才和你说话的人现在无法听见你,或者已经离开游戏了。\n");
	  
	if(!living(obj) || !interactive(obj)) 
	  return notify_fail(obj->name(1)+"现在听不见你说的话。\n");
debug(sprintf( YEL "%s(%s)回答%s(%s):%s" NOR,me->name(1),me->query("id"),obj->name(1),obj->query("id"), arg));		  
write(HBBLU "你回答" + obj->name(1) + ":" + arg + "\n" NOR);
	tell_object(obj, sprintf(HBBLU"%s回答你:%s\n"NOR,
		me->name(1), arg ));

	obj->set_temp("reply", me->query("id"));
	return 1;
}
Пример #26
0
void init()
{
        object me;
        me = this_player();
        if(interactive(me) 
        && me->query_temp("friend_to_xiao")) call_out("ask_him", 1,me );  
} 
Пример #27
0
int valid_leave(object who, string dir)
{
  if (! interactive(who) &&
     dir == "northeast")
    return 0;
  return ::valid_leave(who, dir);
}
Пример #28
0
int main(int argc, char *argv[])
{
	GOptionContext *context;
	GOptionGroup *gatt_group, *params_group, *char_rw_group;
	GError *gerr = NULL;
	GIOChannel *chan;

	opt_dst_type = g_strdup("random");
	opt_sec_level = g_strdup("low");

	context = g_option_context_new(NULL);
	g_option_context_add_main_entries(context, options, NULL);

	if (!g_option_context_parse(context, &argc, &argv, &gerr)) {
		g_printerr("%s\n", gerr->message);
		g_clear_error(&gerr);
	}

	interactive(opt_src, opt_dst, opt_dst_type, opt_psm);

done:
	g_option_context_free(context);
	g_free(opt_src);
	g_free(opt_dst);
	g_free(opt_uuid);
	g_free(opt_sec_level);

	if (got_error)
		exit(EXIT_FAILURE);
	else
		exit(EXIT_SUCCESS);
}
Пример #29
0
mixed do_resurrect_obj(object ob) {
    int corpse;
    object playerob;
    if(ob->isCorpse()) corpse = 1;
    if(interactive(ob)) playerob = ob;
    if( ob->isPlayer() ) playerob = ob->GetPlayerob();
    if( ob->isPlayer() && !playerob ){
        write("You cannot resurrect a player that isn't logged on.");
        return 1;
    }
    if((playerob && !playerob->GetGhost()) || living(ob)) {
        write("You can't resurrect the living.");
        return 1;
    }

    if(base_name(ob) != LIB_CORPSE){
        write("You can only resurrect flesh-based creatures.");
        return 1;
    }

    if(environment(ob) != environment(this_player())) {
        write(capitalize(ob->GetKeyName())+" isn't here.");
        return 1;
    }

    tell_player(this_player(),"You wave your hand, and with a flash "+
            "of light, "+ob->GetCapName()+" comes back to life!");
    tell_player(ob,capitalize(this_player()->GetKeyName())+" waves "+
            possessive(this_player())+
            " hand, and with a flash of light, you come back from the dead!");
    tell_room(environment(this_player()),this_player()->GetCapName()+" waves "+
            possessive(this_player())+
            " hand, and with a flash of light, "+ob->GetCapName()+
            " comes back to life!",
            ({ob, this_player()}) );
Пример #30
0
object restore_data(string name) {
    object link;

    if (find_player(name) && interactive(find_player(name))) {
	return (object)find_player(name)->query_link();
    }

    link = new(CONNECTION);

    seteuid(name);
    export_uid(link);
    seteuid(ROOT_UID);

    link->set("name", name);
    if (link->restore()) {
	return link;
    }

    // If this fails, then let's clean up afterwards...
    link->remove();
    // Some names like .foo weren't getting away.
    if(link) destruct(link);
    if(link) log_file("fingerdest",sprintf("Connection of %s not dested"+
	    " by finger daemon, on %s.\n", name, ctime(time())));
    return 0;
}