Example #1
0
//
// this will need to be called by init_items() in items/items.c
void init_container(void) {
  item_add_type("container", 
  		newContainerData, deleteContainerData,
  		containerDataCopyTo, containerDataCopy, 
  		containerDataStore, containerDataRead);

  // add our hooks
  hookAdd("append_obj_desc", container_append_hook);
  hookAdd("look_at_obj",     container_look_hook);

  // set up the container OLC too
  item_add_olc("container", iedit_container_menu, iedit_container_chooser, 
  	       iedit_container_parser, NULL, container_to_proto);

  // set up our Python extensions
  PyObj_addGetSetter("container_capacity",
    PyObj_getcontainercapacity, PyObj_setcontainercapacity,
    "The maximum amount of weight c container can hold.");
  PyObj_addGetSetter("container_key", 
    PyObj_getcontainerkey, PyObj_setcontainerkey,
    "An object prototype that acts as a key for this container.");
  PyObj_addGetSetter("container_pick_diff",
    PyObj_getcontainerpickdiff, PyObj_setcontainerpickdiff,
    "An integer representing how difficult a container's lock is to pick.");
  PyObj_addGetSetter("container_is_closable", 
    PyObj_getcontainerclosable, PyObj_setcontainerclosable,
    "True or False if the container can be closed.");
  PyObj_addGetSetter("container_is_closed", 
    PyObj_getcontainerclosed, PyObj_setcontainerclosed,
    "True or False if the container is closed.");
  PyObj_addGetSetter("container_is_locked", 
    PyObj_getcontainerlocked, PyObj_setcontainerlocked,
    "True or False if the container is locked.");
}
Example #2
0
//
// this will need to be called by init_items() in items/items.c
void init_furniture(void) {
  item_add_type("furniture", 
  		newFurnitureData, deleteFurnitureData,
  		furnitureDataCopyTo, furnitureDataCopy, 
  		furnitureDataStore, furnitureDataRead);

  // add our hooks
  hookAdd("append_obj_desc", furniture_append_hook);

  // set up the furniture OLC too
  item_add_olc("furniture", iedit_furniture_menu, iedit_furniture_chooser, 
  	       iedit_furniture_parser, NULL, furniture_to_proto);

  // add our getters and setters for furniture
  PyObj_addGetSetter("furniture_capacity", 
    PyObj_getfurncapacity, PyObj_setfurncapacity,
    "The number of characters a furniture object can accomodate.");
  PyObj_addGetSetter("furniture_type", PyObj_getfurntype, PyObj_setfurntype,
    "The type of furniture this is: 'at' or 'on' like e.g., tables vs. couches.");
}
Example #3
0
//*****************************************************************************
// initialization
//*****************************************************************************
void init_persistent(void) {
  p_to_save = newList();

  auxiliariesInstall("persistent_data", 
		     newAuxiliaryFuncs(AUXILIARY_TYPE_ROOM,
				       newPersistentData, deletePersistentData,
				       persistentDataCopyTo, persistentDataCopy,
				       persistentDataStore,persistentDataRead));

  // start our flushing of persistent rooms that need to be saved
  start_update(NULL, 1, flush_persistent_rooms_event, NULL,NULL,NULL);

  //
  // disabled until a better implementation is written.
  //
  // start_update(NULL, 1, close_unused_rooms_event,     NULL,NULL,NULL);

  // listen for objects and characters entering 
  // or leaving rooms. Update those rooms' statuses
  hookAdd("char_to_room",   update_persistent_char_to_room);
  hookAdd("char_from_room", update_persistent_char_from_room);
  hookAdd("obj_to_room",    update_persistent_obj_to_room);
  hookAdd("obj_from_room",  update_persistent_obj_from_room);
  hookAdd("obj_from_obj",   update_persistent_obj_from_obj);
  hookAdd("obj_to_obj",     update_persistent_obj_to_obj);
  hookAdd("room_from_game", update_persistent_room_from_game);
  hookAdd("room_change",    update_persistent_room_change);
  
  // add accessibility to Python
  /*
  PyRoom_addMethod("add_activity",  PyRoom_addActivity,   METH_NOARGS, NULL);
  PyRoom_addMethod("rem_activity",  PyRoom_remActivity,   METH_NOARGS, NULL);
  */
  PyRoom_addMethod("dirty",         PyRoom_dirtyPersistence,  METH_NOARGS,NULL);
  PyRoom_addMethod("unload",        PyRoom_unloadPersistence, METH_NOARGS,NULL);
  PyRoom_addGetSetter("persistent", 
		      PyRoom_getpersistent,     
		      PyRoom_setpersistent, NULL);
}
void init_basic_combat(void) {
  hookAdd("char_to_game", regenStartHook);
	
  add_cmd("attack", NULL, cmd_attack, "player", FALSE);
}
Example #5
0
void init_room_reset(void) {
  hookAdd("reset_zone", zone_reset_hook);
  hookAdd("reset_room", room_reset_hook);
}
//*****************************************************************************
// implementation of scripts.h - triggers portion in triggers.c
//*****************************************************************************
void init_scripts(void) {
  // create our locale stack
  locale_stack = newList();

  // initialize python
  Py_Initialize();

  // initialize all of our modules written in C
  init_PyMudSys();
  init_PyAuxiliary();
  init_PyEvent();
  init_PyStorage();
  init_PyAccount();
  init_PyChar();
  init_PyRoom();
  init_PyExit();
  init_PySocket();
  init_PyObj();
  init_PyMud();
  init_PyHooks();
  init_PyOLC();

  // initialize all of our modules written in Python
  init_pyplugs();

  // initialize the other parts to this module
  init_script_editor();
  init_trighooks();

  // so triggers can be saved to/loaded from disk
  worldAddType(gameworld, "trigger", triggerRead, triggerStore, deleteTrigger,
	       triggerSetKey);

  // deal with auxiliary data
  auxiliariesInstall("trigger_data", 
		     newAuxiliaryFuncs(AUXILIARY_TYPE_CHAR|AUXILIARY_TYPE_ROOM |
				       AUXILIARY_TYPE_OBJ|AUXILIARY_TYPE_SOCKET|
				       AUXILIARY_TYPE_ACCOUNT,
				       newTriggerAuxData,  deleteTriggerAuxData,
				       triggerAuxDataCopyTo, triggerAuxDataCopy,
				       triggerAuxDataStore,triggerAuxDataRead));

  // add in some hooks for preprocessing scripts embedded in descs
  hookAdd("preprocess_room_desc", expand_room_dynamic_descs);
  hookAdd("preprocess_char_desc", expand_char_dynamic_descs);
  hookAdd("preprocess_obj_desc",  expand_obj_dynamic_descs);
  hookAdd("preprocess_exit_desc", expand_exit_dynamic_descs);
  hookAdd("shutdown", finalize_scripts_hook);

  /*
  // add new player commands
  add_cmd("trun", NULL, cmd_scrun, "builder", FALSE);
  */
  extern COMMAND(cmd_tedit); // define the command
  add_cmd("attach",  NULL, cmd_attach, "scripter", FALSE);
  add_cmd("detach",  NULL, cmd_detach, "scripter", FALSE);
  add_cmd("tedit",   NULL, cmd_tedit,  "scripter", TRUE);
  add_cmd("tstat",   NULL, cmd_tstat,  "scripter", FALSE);
  add_cmd("tlist",   NULL, cmd_tlist,  "scripter", FALSE);
  add_cmd("tdelete", NULL, cmd_tdelete,"scripter",FALSE);
  add_cmd("trename", NULL, cmd_trename,"scripter", FALSE);
}