Пример #1
0
//*****************************************************************************
// hooks
//*****************************************************************************
void furniture_append_hook(const char *info) {
  OBJ_DATA *obj = NULL;
  CHAR_DATA *ch = NULL;
  hookParseInfo(info, &obj, &ch);

  if(objIsType(obj, "furniture")) {
    int num_sitters = listSize(objGetUsers(obj));

    // print out how much room there is left on the furniture
    int seats_left = (furnitureGetCapacity(obj) - num_sitters);
    if(seats_left > 0)
      bprintf(charGetLookBuffer(ch), 
	      " It looks like it could fit %d more %s.\r\n",
	      seats_left, (seats_left == 1 ? "person" : "people"));

    // print character names
    if(num_sitters > 0) {
      LIST *can_see = find_all_chars(ch, objGetUsers(obj), "", NULL, TRUE);
      listRemove(can_see, ch);

      char *chars = print_list(can_see, charGetName, charGetMultiName);
      if(*chars) bprintf(charGetLookBuffer(ch), "%s %s %s %s%s.\r\n",
			 chars, (listSize(can_see) == 1 ? "is" : "are"),
			 (furnitureGetType(obj) == FURNITURE_AT ? "at":"on"),
			 see_obj_as(ch, obj),
			 (charGetFurniture(ch) == obj ? " with you" : ""));
      deleteList(can_see);
      free(chars);
    }
  }
}
Пример #2
0
void expand_exit_dynamic_descs(const char *info) {
  EXIT_DATA *me = NULL;
  CHAR_DATA *ch = NULL;
  hookParseInfo(info, &me, &ch);

  PyObject *pyme = newPyExit(me);
  char   *locale = strdup(get_key_locale(roomGetClass(exitGetRoom(me)))); 
  expand_dynamic_descs(charGetLookBuffer(ch), pyme, ch, locale);
  Py_DECREF(pyme);
  free(locale);
}
Пример #3
0
void expand_room_dynamic_descs(const char *info) {
  ROOM_DATA *me = NULL;
  CHAR_DATA *ch = NULL;
  hookParseInfo(info, &me, &ch);

  PyObject *pyme = roomGetPyForm(me);
  char   *locale = strdup(get_key_locale(roomGetClass(me))); 
  expand_dynamic_descs(charGetLookBuffer(ch), pyme, ch, locale);
  Py_DECREF(pyme);
  free(locale);
}
Пример #4
0
//*****************************************************************************
// hooks
//*****************************************************************************
void container_append_hook(const char *info) {
  OBJ_DATA *obj = NULL;
  CHAR_DATA *ch = NULL;
  hookParseInfo(info, &obj, &ch);

  if(objIsType(obj, "container")) {
    bprintf(charGetLookBuffer(ch), " It is %s%s.", 
	    (containerIsClosed(obj) ? "closed":"open"),
	    (containerIsLocked(obj) ? " and locked" : ""));
  }
}
Пример #5
0
void expand_char_dynamic_descs(const char *info) {
  CHAR_DATA *me = NULL;
  CHAR_DATA *ch = NULL;
  hookParseInfo(info, &me, &ch);

  // if we're an NPC, do some special work for displaying us. We don't do 
  // dynamic descs for PCs because they will probably be describing themselves,
  // and we don't want to give them access to the scripting language.
  //if(charIsNPC(me)) {
    PyObject *pyme = charGetPyForm(me);
    char   *locale = strdup(get_key_locale(charGetClass(me))); 
    expand_dynamic_descs(charGetLookBuffer(ch), pyme, ch, locale);
    Py_DECREF(pyme);
    free(locale);
  //}
}