void ASSIGNROOM(room_vnum room, SPECIAL(fname)) { if (real_room(room) >= 0) { world[real_room(room)].func = fname; if (get_spec_name(room_procs, fname) == 0) { sprintf(buf, "SYSWAR: Assign spec not in table to room #%d", room); log(buf); } } else if (!mini_mud) { sprintf(buf, "SYSERR: Attempt to assign spec to non-existant rm. #%d", room); log(buf); } }
void ASSIGNOBJ(obj_vnum obj, SPECIAL(fname)) { if (real_object(obj) >= 0) { obj_index[real_object(obj)].func = fname; if (get_spec_name(obj_procs, fname) == 0) { sprintf(buf, "SYSWAR: Assign spec not in table to obj #%d", obj); log(buf); } } else if (!mini_mud) { sprintf(buf, "SYSERR: Attempt to assign spec to non-existant obj #%d", obj); log(buf); } }
/* functions to perform assignments */ void ASSIGNMOB(mob_vnum mob, SPECIAL(fname)) { if (real_mobile(mob) >= 0) { mob_index[real_mobile(mob)].func = fname; if (get_spec_name(mob_procs, fname) == 0) { sprintf(buf, "SYSWAR: Assign spec not in table to mob #%d", mob); log(buf); } } else if (!mini_mud) { sprintf(buf, "SYSERR: Attempt to assign spec to non-existant mob #%d", mob); log(buf); } }
void do_mob_report (struct char_data *ch) { struct char_data *mob; FILE *reportfile; int i; if (!(reportfile = fopen("report.mob", "w"))) { mlog("SYSERR: Mob report file unavailable."); send_to_char ("Report.mob could not be generated.\r\n",ch); return; } sprintf(buf, "MOBS\n----\n"); for (i=0; i<top_of_mobt;i++) { mob=read_mobile(i, REAL); char_to_room(mob, 0); sprintf(buf+strlen(buf), "[%5d] %s Spec Proc: ", GET_MOB_VNUM(mob), GET_NAME(mob)); if (mob_index[GET_MOB_RNUM(mob)].func!=NULL) get_spec_name(GET_MOB_RNUM(mob), buf2,'m'); else sprintf(buf2, "none"); sprintf(buf+strlen(buf), "%s\n",buf2); sprintf(buf+strlen(buf),mob->player.description); sprintf(buf+strlen(buf),"Difficulty: %d XP: %d HP: %d Mana: %d Gold %d\n", GET_DIFFICULTY(mob), GET_EXP(mob), GET_MAX_HIT(mob), GET_MAX_MANA(mob), GET_GOLD(mob)); sprintf(buf+strlen(buf),"Passive Defense: %d Damage Reduction: %d ", GET_PD(mob), GET_REDUCTION(mob)); sprintf(buf+strlen(buf), "Attack Type: %s\n", attack_hit_text[mob->mob_specials.attack_type].singular); sprintbit(MOB_FLAGS(mob), action_bits, buf2, sizeof(buf2)); sprintf(buf+strlen(buf),"Flags: %s\n", buf2); sprintbit(AFF_FLAGS(mob), affected_bits, buf2, sizeof(buf2)); sprintf(buf+strlen(buf),"Affects: %s\n\n-------\n", buf2); extract_char(mob); fprintf(reportfile, buf); buf[0]='\0'; }/*for i=0...*/ fclose (reportfile); send_to_char ("report.mob printed\r\n",ch); }
void do_obj_report (struct char_data *ch) { struct obj_data *obj, *key; int i=0, j=0, found=0; FILE *reportfile; if (!(reportfile = fopen("report.obj", "w"))) { mlog("SYSERR: Object report file unavailable."); send_to_char ("Report.obj could not be generated.\r\n",ch); return; } sprintf(buf, "OBJECTS\n-------\n"); for (i=0; i<top_of_objt;i++) { obj=read_object(i, REAL); sprintf(buf+strlen(buf), "[%5d] %s\nSpec Proc: ", GET_OBJ_VNUM(obj), obj->short_description); if (obj_index[GET_OBJ_RNUM(obj)].func!=NULL) get_spec_name(GET_OBJ_RNUM(obj), buf2,'o'); else sprintf(buf2, "none"); sprintf(buf+strlen(buf), "%s Aliases: %s\n", buf2, GET_OBJ_NAME(obj)); sprinttype(GET_OBJ_TYPE(obj), item_types, buf2, sizeof(buf2)); sprintf (buf+strlen(buf),"Type: %s Worn on: ",buf2); sprintbit(obj->obj_flags.wear_flags, wear_bits, buf2, sizeof(buf2)); sprintf(buf+strlen(buf), "%s\n", buf2); sprintf(buf+strlen(buf), "Weight: %d, Value: %d, Cost/day: %d, Timer: %d\n", GET_OBJ_WEIGHT(obj), GET_OBJ_COST(obj), GET_OBJ_RENT(obj), GET_OBJ_TIMER(obj)); sprintbit(obj->obj_flags.bitvector, affected_bits, buf2, sizeof(buf2)); sprintf(buf+strlen(buf), "Affects player: %s\n",buf2); sprintbit(obj->obj_flags.bitvector, affected_bits, buf2, sizeof(buf2)); sprintf(buf+strlen(buf), "Extra bits: %s\n",buf2); switch (GET_OBJ_TYPE(obj)) { case ITEM_LIGHT: if (GET_OBJ_VAL(obj, 2) == -1) strcpy(buf, "Hours left: Infinite\n"); else sprintf(buf+strlen(buf), "Hours left: [%d]\n", GET_OBJ_VAL(obj, 2)); break; case ITEM_SCROLL: case ITEM_POTION: sprintf(buf+strlen(buf), "Spells: (Level %d) %s, %s, %s\n", GET_OBJ_VAL(obj, 0), skill_name(GET_OBJ_VAL(obj, 1)), skill_name(GET_OBJ_VAL(obj, 2)), skill_name(GET_OBJ_VAL(obj, 3))); break; case ITEM_WAND: case ITEM_STAFF: sprintf(buf+strlen(buf), "Spell: %s at level %d, %d (of %d) charges remaining\n", skill_name(GET_OBJ_VAL(obj, 3)), GET_OBJ_VAL(obj, 0), GET_OBJ_VAL(obj, 2), GET_OBJ_VAL(obj, 1)); break; case ITEM_WEAPON: sprintf(buf+strlen(buf), "Ave. Dam: %d, Message type: %d\n", get_weapon_dam(obj), GET_OBJ_VAL(obj, 3)); break; case ITEM_ARMOR: sprintf(buf+strlen(buf), "Passive Defense: [%d]\n", GET_OBJ_VAL(obj, 0)); sprintf(buf+strlen(buf), "Damage Reduction: [%d]\n", GET_OBJ_VAL(obj, 1)); break; case ITEM_TRAP: sprintf(buf+strlen(buf), "Spell: %d, - Hitpoints: %d\n", GET_OBJ_VAL(obj, 0), GET_OBJ_VAL(obj, 1)); break; case ITEM_CONTAINER: sprintbit(GET_OBJ_VAL(obj, 1), container_bits, buf2, sizeof(buf2)); sprintf(buf+strlen(buf), "Weight capacity: %d, Lock Type: %s, Key Num: %d ", GET_OBJ_VAL(obj, 0), buf2, GET_OBJ_VAL(obj, 2)); if (GET_OBJ_VAL(obj, 2) > 0) { key=read_object(GET_OBJ_VAL(obj,2), VIRTUAL); if (key) { sprintf(buf+strlen(buf), "(%s)", GET_OBJ_NAME(key)); extract_obj(key); } else sprintf(buf+strlen(buf), "(Error: Key does not exist!)"); } sprintf(buf+strlen(buf), "\n"); break; case ITEM_DRINKCON: case ITEM_FOUNTAIN: sprinttype(GET_OBJ_VAL(obj, 2), drinks, buf2, sizeof(buf2)); sprintf(buf+strlen(buf), "Capacity: %d, Contains: %d, Poisoned: %s, Liquid: %s\n", GET_OBJ_VAL(obj, 0), GET_OBJ_VAL(obj, 1), YESNO(GET_OBJ_VAL(obj, 3)),buf2); break; case ITEM_FOOD: sprintf(buf+strlen(buf), "Makes full: %d, Poisoned: %s\n", GET_OBJ_VAL(obj, 0),YESNO(GET_OBJ_VAL(obj, 3))); break; case ITEM_MONEY: sprintf(buf, "Coins: %d\n", GET_OBJ_VAL(obj, 0)); break; case ITEM_PORTAL: sprintf(buf, "To room: %d\n", GET_OBJ_VAL(obj, 0)); break; default: sprintf(buf+strlen(buf), "Values 0-3: [%d] [%d] [%d] [%d]\n", GET_OBJ_VAL(obj, 0), GET_OBJ_VAL(obj, 1), GET_OBJ_VAL(obj, 2), GET_OBJ_VAL(obj, 3)); break; } found = 0; sprintf(buf+strlen(buf), "Affects on player stats:\n"); for (j = 0; j < MAX_OBJ_AFFECT; j++) if (obj->affected[j].modifier) { sprinttype(obj->affected[j].location, apply_types, buf2, sizeof(buf2)); sprintf(buf+strlen(buf), " %+d to %s\n",obj->affected[j].modifier, buf2); found=1; } if (!found) sprintf(buf+strlen(buf)," None\n"); sprintf(buf+strlen(buf), "\n--------\n"); extract_obj(obj); fprintf(reportfile, buf); buf[0]='\0'; }/*for i=0...*/ fclose (reportfile); send_to_char ("report.obj printed\r\n",ch); }
int save_objects(zone_rnum zone_num) { int counter, counter2, realcounter; FILE *fp; struct obj_data *obj; struct extra_descr_data *ex_desc; if (zone_num < 0 || zone_num > top_of_zone_table) { log("SYSERR: GenOLC: save_objects: Invalid real zone number %d. (0-%d)", zone_num, top_of_zone_table); return FALSE; } sprintf(buf, "%s/%d.new", OBJ_PREFIX, zone_table[zone_num].number); if (!(fp = fopen(buf, "w+"))) { mudlog("SYSERR: OLC: Cannot open objects file!", BRF, LVL_IMMORT, TRUE); return FALSE; } /* * Start running through all objects in this zone. */ for (counter = zone_table[zone_num].number * 100; counter <= zone_table[zone_num].top; counter++) { if ((realcounter = real_object(counter)) >= 0) { if ((obj = &obj_proto[realcounter])->action_description) { buf1[MAX_STRING_LENGTH - 1] = '\0'; strncpy(buf1, obj->action_description, MAX_STRING_LENGTH - 1); strip_cr(buf1); } else *buf1 = '\0'; fprintf(fp, "#%d\n" "%s~\n" "%s~\n" "%s~\n" "%s~\n" "%d %d %d %ld\n" "%d %d %d %d\n" "%d %d %d %d\n", GET_OBJ_VNUM(obj), (obj->name && *obj->name) ? obj->name : "undefined", (obj->short_description && *obj->short_description) ? obj->short_description : "undefined", (obj->description && *obj->description) ? obj->description : "undefined", buf1, GET_OBJ_TYPE(obj), GET_OBJ_EXTRA(obj), GET_OBJ_WEAR(obj), GET_OBJ_PERM(obj), GET_OBJ_VAL(obj, 0), GET_OBJ_VAL(obj, 1), GET_OBJ_VAL(obj, 2), GET_OBJ_VAL(obj, 3), GET_OBJ_WEIGHT(obj), GET_OBJ_COST(obj), GET_OBJ_RENT(obj), GET_OBJ_LEVEL(obj)); script_save_to_disk(fp, obj, OBJ_TRIGGER); /* * Do we have extra descriptions? */ if (obj->ex_description) { /* Yes, save them too. */ for (ex_desc = obj->ex_description; ex_desc; ex_desc = ex_desc->next) { /* * Sanity check to prevent nasty protection faults. */ if (!ex_desc->keyword || !ex_desc->description || !*ex_desc->keyword || !*ex_desc->description) { mudlog("SYSERR: OLC: oedit_save_to_disk: Corrupt ex_desc!", BRF, LVL_IMMORT, TRUE); continue; } buf1[MAX_STRING_LENGTH - 1] = '\0'; strncpy(buf1, ex_desc->description, MAX_STRING_LENGTH - 1); strip_cr(buf1); fprintf(fp, "E\n" "%s~\n" "%s~\n", ex_desc->keyword, buf1); } } /* * Do we have affects? */ for (counter2 = 0; counter2 < MAX_OBJ_AFFECT; counter2++) if (obj->affected[counter2].modifier) fprintf(fp, "A\n" "%d %d\n", obj->affected[counter2].location, obj->affected[counter2].modifier); /* And now the spec-proc */ if (obj_index[realcounter].func != NULL) fprintf(fp, "S\n%s\n", obj_procs[get_spec_name(obj_procs, obj_index[realcounter].func)].name); } } /* * Write the final line, close the file. */ fprintf(fp, "$~\n"); fclose(fp); sprintf(buf2, "%s/%d.obj", OBJ_PREFIX, zone_table[zone_num].number); remove(buf2); rename(buf, buf2); remove_from_save_list(zone_table[zone_num].number, SL_OBJ); return TRUE; }