Esempio n. 1
0
void event_exit(object ob, varargs string msg, object dest, mixed avoid)
{
  string new_name;

  ::event_exit(ob, msg, dest, avoid);

  if (!msg || !strlen(msg))
    return;

  // items added to our inventory also trigger event_enter
  if (environment(ob) == this_object())
    return;

  if (avoid)
  {
    if (pointerp(avoid) && (member_array(this_object(), avoid) != -1))
      return;
    else if (objectp(avoid) && (avoid == this_object()))
      return;
  }

  if (living(ob) && environment(this_object()))
  {
    if (this_object()->check_dark(environment(this_object())->query_light()) == 0)
    {
      // change player appereance from /table/hud_table.c, neverbot 10/04
      new_name = (string)HUD->query_colored_name(this_object(), ob, ob->query_cap_name(), 1);
      msg = replace_string(msg, ob->query_cap_name(), new_name);

      write(msg);
    }
    else
      write(_LANG_EVENTS_SOMEBODY_LEAVES);
  }
}
Esempio n. 2
0
int push_mail( mapping outmsg ) {
  mixed *list;
  int i;
  
  outmsg["SUBJECT"] = outmsg["subject"];
  outmsg["CC"] = outmsg["cc"];
  outmsg["DATE"] = ( outmsg["date"] );
  outmsg["MSG"] = outmsg["message"];
  outmsg["WIZFROM"] = outmsg["from"] + "@" + Mud_name();
  outmsg["WIZTO"] = outmsg["to"];
  
  // Used only for housekeeping on our end.
  outmsg["TIME"] = time();
 
  map_delete( outmsg, "subject" );
  map_delete( outmsg, "cc" );
  map_delete( outmsg, "to" );
  map_delete( outmsg, "from" );
  map_delete( outmsg, "date" );
  map_delete( outmsg, "message" );
  
  
// from, to, subject, msg, cc, date
// First, make sure CC and WIZTO have proper format.
  list = outmsg["WIZTO"];
  
  i = sizeof( list );
  while( i-- ) {
    if( strsrch( list[i], "@" ) < 0 )
      list[i] += "@" + Mud_name();
  }
  
  if( !pointerp( list ) ) list = ({ list });
mixed cmd(string) {
   int i;
   mixed *hist;

   if (!wizardp(this_player())) {
      return 0;
   }
   hist = HIST_HANDLER->query_chat_history("liaison");
   if (!pointerp(hist) || !sizeof(hist)) {
      return notify_fail("Nobody said anything on the liaison channel.\n");
   }
   write("The liaison channel history is:\n");
   for (i=0;i<sizeof(hist);i++) {
      if (sizeof(hist[i]) > 2) {
         efun::tell_object(this_player(), 
                (string)this_player()->fix_string(sprintf("*%s* %s%-=*s\n",
                ctime(hist[i][2])[11..18], hist[i][0], 
                (int)this_player()->query_cols()-strlen(hist[i][0])-11,
                hist[i][1])));
      } else {
         efun::tell_object(this_object(), 
                (string)this_player()->fix_string(sprintf("%s%-=*s\n",
                hist[i][0], (int)this_player()->query_cols()-strlen(hist[i][0]),
                hist[i][1])));
      }
   }
   return 1;
}
Esempio n. 4
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"];
	}	
}
Esempio n. 5
0
/*
 * Returns a void pointer to the data the cell holds,
 * whose data type must be compatible with `type`.
 */
static void* make_arg(ffi_type *type, cons_t* val)
{
  if ( type == &ffi_type_uint ||
       type == &ffi_type_sint )
  {
    if ( !integerp(val) )
      raise(runtime_exception("Argument must be an integer"));

    return static_cast<void*>(&val->number.integer);
  }

  if ( type == &ffi_type_pointer ) {
    if ( stringp(val) ) return static_cast<void*>(&val->string);
    if ( pointerp(val) ) return val->pointer->value;
    if ( integerp(val) ) return &val->number.integer;
    if ( realp(val) ) return &val->number.real;

    raise(runtime_exception(format(
      "Unsupported pointer type %s", to_s(type_of(val)).c_str())));
  }

  const std::string expect = ffi_type_name(type),
                     given = to_s(type_of(val));

  raise(runtime_exception(format(
    "Foreign function wants %s but input data was %s, "
    "which we don't know how to convert.",
    indef_art("'"+expect+"'").c_str(),
    indef_art("'"+given+"'").c_str())));

  return NULL;
}
Esempio n. 6
0
protected mixed execute_anything(mixed fun, varargs mixed args)
{
  if ( closurep(fun) && objectp(query_closure_object(fun)) )
    return apply(fun, args);

  if (stringp(fun))
    return call_other(this_object(), fun, args...);

  if ( pointerp(fun))
  {
    if (sizeof(fun) != 2)
      raise_error(sprintf("execute_anything(): <fun> argument must "
                         "have 2 elements if array.\n"));
    object ob;
    if ( stringp(fun[0]) )
      ob=find_object(fun[0]);
    else
      ob=fun[0];

    if ( !objectp(ob) || !stringp(fun[1]) )
      return 0;

    return call_other(ob, fun[1], args...);
  }
  return 0;
}
Esempio n. 7
0
void check_me(object me)
{
	mapping *notes;
	int i, unread, last_read_time;
	object board;
	seteuid(getuid());
	board=find_object("/clone/board/news_b");
	if (!board) board=new("/clone/board/news_b");
	notes = board->query("notes");
	if( !pointerp(notes) || !sizeof(notes) )	return;
	if( me )
	{
		last_read_time = (int)me->query("board_last_read/" + (string)board->query("board_id"));
		for(unread = 0, i=sizeof(notes)-1; i>=0; i--, unread ++)
			if( notes[i]["time"] <= last_read_time ) break;
	}
	if( unread )
		{
      if (!me->query_temp("news"))
			tell_object(me,HIY"在你离线期间侠客行一百有过更新消息,请仔细阅读以下内容。\n\n"NOR);
      me->set_temp("news",1);
      seteuid(ROOT_UID);
      me->force_me("news new");
    }
  if (unread > 1 ) 
  {
  	remove_call_out("check_me");
  	call_out("check_me",60,me);  
  }
}
Esempio n. 8
0
mixed *
copy_array(mixed *array)
{
    if (!pointerp(array))
	return 0;
    else
	return array[0..(sizeof(array) - 1)];
}
Esempio n. 9
0
File: sos.c Progetto: aricxu/xkx100
// This is the callback function to process the string returned from the
// editor defined in F_EDIT of player object.
void done_post(object me, mapping note, string text)
{
	int i; //line 20
	note["msg"] = text;
	i = sizeof(notes);
	for( ; i > 0; i-- ) 
		if( notes[i-1]["author"] == me->query("id") ) break;
	if( !pointerp(notes) || i > 0 )
	if(!sizeof(notes)) notes = ({ note });
Esempio n. 10
0
void reward (object who)
{
  object me = this_object ();
  int points = who->query_temp("quest/reward_point");
  string channel = "sldh";
  string *channels = who->query("channels");

  if ( !pointerp(channels) || !sizeof(channels) )
    channels = ({ channel });
Esempio n. 11
0
int
index(mixed target, mixed *array, int offset)
{
   int i;
   
   if( !pointerp(array) || !intp(offset) ) return -1;
   array = array[offset..<1];
   if( (i = member_array(target, array)) < 0 ) return -1;
   else return i+offset;
}
Esempio n. 12
0
string *parse_command_id_list()
{
  string *applied_id;

  if( pointerp(applied_id = query_temp("apply/id")) 
  &&  sizeof(applied_id) )
   return applied_id;
  else
   return my_id;
}
Esempio n. 13
0
int perform(object me, object target)
{
	string msg;
	int skl_me, skl_you, extra_me, extra_you,i;
	int FLAG=0;
	object you,ob,*obs;
	if( !target ) target = offensive_target(me);
	if( !target
	||	!target->is_character()
	||	!me->is_fighting(target) )
		return notify_fail("[一指定乾坤]只能对战斗中的对手使用。\n");
	if(pointerp(obs=me->query_team()) )
	{
	FLAG=1;
	for(i=0;i<sizeof(obs);i++)
	{
	if(obs[i] == me) continue;
	if(!obs[i]) {FLAG=0;continue;}
	if(environment(obs[i]) != environment(me)) {FLAG=0;continue;}
	if(!obs[i]->query_skill("yiyangzhi")) {FLAG=0;continue;}
	if(objectp(ob=obs[i]->query_temp("weapon"))) {FLAG=0;continue;}
	if(obs[i]->query_skill_mapped("unarmed") != "yiyangzhi") {FLAG=0;continue;}
	}	
	if(sizeof(obs) !=2) FLAG=0;
	}
	skl_me=(int)me->query_skill("unarmed");
	extra_me=(int)me->query_temp("apply/damage")+(int)me->query_str()*(int)me->query_str()/10;
	if(FLAG)
	{
		if(obs[0]==me) you=obs[1]; else you=obs[0];
	skl_you=(int)you->query_skill("unarmed");
	extra_you=(int)you->query_temp("apply/damage")+(int)you->query_str()*(int)you->query_str();
	msg = HIG+"$N施展出阴柔的柔虹指,"+ HIR + you->name()+"施展出刚阳的一阳指,\n"+ HIY +
	"无数指影夹杂着阴冷炽热的指风,点向$n的全身!\n\n" + NOR;
	me->add_temp("apply/attack",(skl_you+skl_me)/5);
	me->add_temp("apply/damage",(extra_you+extra_me));
        COMBAT_D->do_attack(me,target, me->query_temp("weapon"), TYPE_REGULAR,msg);
	me->add_temp("apply/attack",-(skl_you+skl_me)/5);
        me->add_temp("apply/damage",-(extra_you+extra_me));
	you->kill_ob(target);
	}
	else
	{
        msg = HIG+"$N施展出阴柔的柔虹指,"+ HIY +
        "无数指影夹杂着阴冷的指风,点向$n的全身!\n\n" + NOR;
        me->add_temp("apply/attack",skl_me/10);
        me->add_temp("apply/damage",extra_me/3);
        COMBAT_D->do_attack(me,target, me->query_temp("weapon"), TYPE_REGULAR,msg);
        me->add_temp("apply/attack",-skl_me/10);
        me->add_temp("apply/damage",-extra_me/3);
	}	
	me->start_busy(5);
	return 1;
}
Esempio n. 14
0
/** Return the armour class of this object. If called with a string
 * parameter, then one particular ac is returned (ie, query_ac("fire")
 * returns the armour's fire ac).
 *
 * If called without any parameters and there are any modifiers defined, the
 * object's entire ac mapping is returned. Otherwise, the base ac is returned.
 */
varargs mixed query_ac(string param) {
  mapping temp = copy(ac_mod);
  string str;
  if (param)
    return ac_mod[param]+base_ac;

  if( pointerp(ac_mod) && sizeof(ac_mod) ) {
    foreach (str: ac_mod)
      temp[str] = ac_mod[str] + base_ac;
    return temp;
  } else {
Esempio n. 15
0
/*
 * Function name: visible_access
 * Description  : Provides a numerical context to a selection by a player.
 *                This is especially made for the results of parse_command().
 * Arguments    : mixed *arr - an array with as first element the number that
 *                    designates the objects to match and further the items
 *                    to test against.
 *                string ascfunc - the function to filter with.
 *                object ascobj - the object to filter with
 *                int normflag - if true, exclude this_player() from the results.
 *                int include_invis - if true, invis objects are matched.
 * Returns      : object * - the objects that matched, or ({ }).
 */
varargs mixed *
visible_access(mixed *arr, string acsfunc, object acsobj, int normflag,
	       int include_invis)
{
    int num;
    object *invenv;
    object *items;

    /* Access failure. */
    if (!pointerp(arr) || !sizeof(arr) || !this_player())
	return  ({ });
Esempio n. 16
0
sexpr equalp (sexpr a, sexpr b)
{
    if (a == b) return sx_true;

    if (!pointerp(a) || !pointerp(b)) return sx_false;

    if ((stringp(a) && stringp(b)) || (symbolp(a) && symbolp(b)))
    {
        struct sexpr_string_or_symbol
                *sa = (struct sexpr_string_or_symbol *)sx_pointer(a),
                *sb = (struct sexpr_string_or_symbol *)sx_pointer(b);
        unsigned long i;

        return (str_hash(sa->character_data, &i) ==
                str_hash(sb->character_data, &i))
                ? sx_true : sx_false;
    }
    else if (consp(a) && consp(b))
    {
        return ((truep(equalp(car(a), car(b))) &&
                 truep(equalp(cdr(a), cdr(b))))) ?
                sx_true : sx_false;
    }
    else if (customp(a) && customp(b))
    {
        int type = sx_type (a);

        if (type == sx_type (b))
        {
            struct sexpr_type_descriptor *d = sx_get_descriptor (type);

            if ((d != (struct sexpr_type_descriptor *)0) &&
                (d->equalp != (void *)0))
            {
                return d->equalp (a, b);
            }
        }
    }

    return sx_false;
}
Esempio n. 17
0
int main(object me, string arg)
{
        object ob;

        if (! arg ||
            ! (ob = present(arg, environment(me))) ||
            ! living(ob) ||
            ! ob->is_character() ||
            ob == me)
                return notify_fail("你想和谁成为伙伴?\n");

        if (! pointerp(me->query_team()) || me->is_team_leader())
        {
                if (sizeof(me->query_team()) >= 12)
                        return notify_fail("你这个队伍里面的人实在是太多"
                                           "了,大家都照顾不过来了。\n");

                if (me == ob->query_temp("pending/team"))
                {
                        if (! pointerp(me->query_team()))
                        {
                                ob->add_team_member(me);
                                message_vision("$N决定加入$n的队伍。\n", me, ob);
                        } else
                        {
                                me->add_team_member(ob);
                                message_vision("$N决定让$n加入队伍。\n", me, ob);
                        }
                        ob->delete_temp("pending/team");
                        return 1;
                } else
                {
                        message_vision("$N邀请$n加入$P的队伍。\n", me, ob);
                        tell_object(ob, YEL "如果你愿意加入,请用 team with " +
                                    me->query("id") + "。\n" NOR);
                        me->set_temp("pending/team", ob);
                        return 1;
                }
        } else
                return notify_fail("只有队伍领袖可以邀请别人加入。\n");
}
void event_death(object ob, string mess) {
   mixed *bit;
   int ret;

   bit = arg();
   if (functionp(bit)) {
      ret = evaluate(bit, player, ob, mess);
   } else if (pointerp(bit)) {
      ret = call_other(bit[0], bit[1], player, ob, mess);
   }
   player->event_exit(ob, mess);
} /* event_death() */
Esempio n. 19
0
string replace(string str, mixed bing, varargs string rep) 
{
  int i;

  if (pointerp(bing)) 
  {
    for (i = 0; i < sizeof(bing); i+=2)
      str = replace_string(str, bing[i], bing[i+1]);
    return str;
  }
  return replace_string(str, bing, rep);
}
Esempio n. 20
0
//news all  ==  look board  
int do_look(object board)
{
	mapping *notes;
	int i, t, max,size,num,last_time_read;
	string msg, myid;
	object ob = board;
	object me = this_player();
	notes = ob->query("notes");
	size = (int)sizeof(notes)/20;
	if( !pointerp(notes) || !sizeof(notes) ) 
	{
		msg="[ 目前没有任何更新消息 ]\n";
		message("vision", msg, me);
		return 1;
	}
	
	msg="侠客行一百最近的更新消息如下:\n"
	HIW"编号"NOR"──"HIY"标题"NOR"────────────────────"HIR"作者"NOR"─"HIG"回复数"NOR"───"HIM"时间"NOR"─────"NOR;
	last_time_read = me->query("board_last_read/news_b");
	message("vision", msg, me);
//	for(t=0; t<=size; t++)
    for(t=size;t>=0;t--)
    	{
//    		num = t*20;                0-20  0-62 共63个消息  size=3
        num = (sizeof(notes)-1)-(size-t)*20;      // (24-1)-(1-2)   num=62 42 22 2
//    		max = num + 20;
        max = num-20;          //          max=42 22 2 -18
//    		if( max > sizeof(notes)) max = (int)sizeof(notes);
        if( max <0 ) max = -1;  //         max=42 22 2 -1
    		i=num;                 //         i= 62 42 22 2
      	msg = sprintf("\n%s[%2d]"HIR" %s "HIY"%-29s"HIR" %20s "HIG"%+3d"HIM"   [%s]"NOR, ( notes[i]["time"] > last_time_read ? HIY:HIW), i+1, (notes[i]["mark"]=="M" ? "M":" "),  notes[i]["title"], notes[i]["author"]+"("+notes[i]["owner"]+")", sizeof(notes[i]["re"]), ctime(notes[i]["time"])[0..15] );
      //                 HIR[21]       M     title       qingyun  +0
//                                         msg= post 62 42 22 2
//    		for(i=num+1; i<max; i++)   // note[1]-note[19]  0-19
        for (i=num-1; i>max;i--)     //i=61,43  41,23 21,3  1,0 
    		{
//        msg += sprintf("\n%s["HIW"%2d"NOR"]"HIR" %s "HIY"%-29s"HIR" %12s "HIG"%+3d"HIM"   [%s]"NOR, ( notes[i]["time"] > last_time_read ? HIY:""), i+1, (notes[i]["mark"]=="M" ? "M":" "),  notes[i]["title"], notes[i]["author"], sizeof(notes[i]["re"]), ctime(notes[i]["time"])[0..15] );
        msg += sprintf("\n%s[%2d]"HIR" %s "HIY"%-29s"HIR" %20s "HIG"%+3d"HIM"   [%s]"NOR, ( notes[i]["time"] > last_time_read ? HIY:HIW), i+1, (notes[i]["mark"]=="M" ? "M":" "),  notes[i]["title"], notes[i]["author"]+"("+notes[i]["owner"]+")", sizeof(notes[i]["re"]), ctime(notes[i]["time"])[0..15] );
    		}
    		message("vision", msg, me);
        }
        
/*      i = sizeof(notes);
      msg = "";
      while(i--)
          msg += sprintf("\n%s["HIW"%2d"NOR"]"HIR" %s "HIY"%-29s"HIR" %12s "HIG"%+3d"HIM"   [%s]"NOR, ( notes[i]["time"] > last_time_read ? HIY:""), i+1, (notes[i]["mark"]=="M" ? "M":" "),  notes[i]["title"], notes[i]["author"], sizeof(notes[i]["re"]), ctime(notes[i]["time"])[0..15] );
    	message("vision", msg, me);
*/        msg = "\n───────────────────────────────────────────\n";
        msg += sprintf("共有 %d 条消息。\n", sizeof(notes));
    	message("vision", msg, me);
    	return 1;
}
Esempio n. 21
0
/**
 * Internal function to recurse through nested arrays of a lambda closure.
 *
 * @param  arr array to rebuild
 * @return     the rebuilt array
 */
private mixed *_reconstruct(mixed *arr) {
  int size = sizeof(arr);
  mixed *result = allocate(size + 1);
  result[0] = #'({; //'
  for (int i = 0; i < size; i++) {
    if (pointerp(arr[i])) {
      result[i + 1] = _reconstruct(arr[i]);
    } else {
      result[i + 1] = arr[i];
    }
  }
  return result;
}
Esempio n. 22
0
int id(string str)
{
  string *applied_id;

  if( this_player() && !this_player()->visible(this_object()) ) return 0;

  if( pointerp(applied_id = query_temp("apply/id")) 
  &&  sizeof(applied_id) ) 
   if( member_array(str, applied_id)!=-1 )
    return 1;
   else
    return 0;
    
  // If apply/id exists, this object is "pretending" something, don't
  // recognize original id to prevent breaking the pretending with "id"
  // command.

  if( pointerp(my_id) && member_array(str, my_id)!=-1 )
   return 1;
  else
   return 0;
}
Esempio n. 23
0
void main( string a )
{
  string output, file_name1, file_name2;
  string *lines1, *lines2;
  string *ONEnotTWO, *TWOnotONE;

  if( !a || 2 != sscanf( a, "%s %s", file_name1, file_name2 ) )
  {
    write( "Syntax: diff <file1> <file2>\n" ); 
    return;
  }
  lines1 = get_lines( file_name1 );
  lines2 = get_lines( file_name2 );
  if( !pointerp( lines1 ) || !pointerp( lines2 ) )
  {
    write( "No comparison made.\n" );
    return;
  }
  if( lines1 == lines2 )
  {
    write( file_name1 + " and " + file_name2 + " are the same file.\n" );
    return;
  }
  ONEnotTWO = filter_array( lines1, "sort", this_object(), lines2 );
  TWOnotONE = filter_array( lines2, "sort", this_object(), lines1 );
  if( ONEnotTWO == TWOnotONE )
  {
    write( file_name1 + " and " + file_name2 + " have the same lines.\n" );
    return;
  }
  output = "[In " + file_name1 + " but not in " + file_name2 + ":]\n" +
	   implode( ONEnotTWO, "\n" ) + "\n" +
	   "\n[In " + file_name2 + " but not in " + file_name1 + ":]\n" +
	   implode( TWOnotONE, "\n" ) + "\n";
 
  more( explode(output, "\n") );
 
  return;
}
Esempio n. 24
0
void add_bit(string name, string alias, mixed *varr)
{
   int i;

   i = member_array(name, bits);
   if (i >= 0) {
      if (pointerp(bits[i+1])) i--;
      bits[i] = name;
      bits[i+1] = alias;
      bits[i+2] = varr;
      return;
   }
   bits += ({ name, alias, varr });
Esempio n. 25
0
mixed main(object me, string arg)
{
    int i;
    string str;
    object *target;

    if( !stringp(arg) || arg == "" ) return notify_fail("你要找谁?\n");
    LOCATE_Q->send_locate_q(arg);
    write("正在找寻,请稍候。\n");
    target = LOCATE_Q->find_users(arg);
    if(pointerp(target) && sizeof(target)) 
	for(i=0; i<sizeof(target); i++) 
	    write(target[i]->short(1)+"正在连线中。\n");
    else
Esempio n. 26
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"];
        }       
}
Esempio n. 27
0
add_property(arg1,arg2) {
  mapping map;
  int i,size;    
  if (mappingp(arg1)) {
    prop += arg1;
    map=arg1;
    arg1=m_indices(map);
    arg2=m_values(map);
    for(i=0,size = sizeof(arg1);i<size;i++) 
      map_array("/obj/daemon/propd"->give_me_links(arg1[i]),"add_property",this_object(),arg2[i]);    
    return;
  }
  if (!arg2)
    arg2 = 1;
  if (stringp(arg1)) {
    map_array("/obj/daemon/propd"->give_me_links(arg1),"add_property",this_object(),arg2);
    prop[arg1] = arg2;
    return;
  }
  if (pointerp(arg1))    
    if (pointerp(arg2))
      {
	map = mkmapping(arg1,arg2);
	prop+=map;
	arg1=m_indices(map);
	arg2=m_values(map);
	for(i=0,size = sizeof(arg1);i<size;i++) 
	  map_array("/obj/daemon/propd"->give_me_links(arg1[i]),"add_property",this_object(),arg2[i]);
      }
      else
	{
	  for(i=0,size = sizeof(arg1);i<size;i++) {
	    prop[arg1[i]] = arg2;
	    map_array("/obj/daemon/propd"->give_me_links(arg1[i]),"add_property",this_object(),arg2);
	  }
	}   
}
Esempio n. 28
0
/*
* calling this is very rude unless you are createing the object as it
* erases all of the writing off it.
*/
void set_read_mess(mixed str, varargs string lang, int size)
{
    if (pointerp(str))
    {
        read_mess = str;
        return;
    }

    if (!lang)
        lang = "comun";
    if (!size)
        size = 1;

    if (strlen(str))
        read_mess = ({ ({ str, "", lang, size }) });
Esempio n. 29
0
File: wield.c Progetto: mudchina/fy4
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"];
                }
        }
} 
Esempio n. 30
0
/*
 * calling this is very rude unless you are createing the object as it
 * erases all of the writing off it.
 */
varargs void set_read_mess(mixed str, string lang, int size) { 
  if (pointerp(str)) {
    read_mess = str;
    return ;
  }
  if (!read_mess && str && environment()) {
    filter_array(all_inventory(environment()), "add_read_this", this_object());
    environment()->add_command("read", this_object());
  }
  if (!lang)
    lang = "common";
  if (!size)
    size = 1;
  if (str) {
    read_mess = ({ ({ str, 0, lang, size }) });
  } else