/************************************************************************** * Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer, * * Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe. * * * * Merc Diku Mud improvements copyright (C) 1992, 1993 by Michael * * Chastain, Michael Quan, and Mitchell Tse. * * * * In order to use any part of this Merc Diku Mud, you must comply with * * both the original Diku license in 'license.doc' as well the Merc * * license in 'license.txt'. In particular, you may not remove either of * * these copyright notices. * * * * Much time and thought has gone into this software and you are * * benefiting. We hope that you share your changes too. What goes * * around, comes around. * *************************************************************************** * ROM 2.4 is copyright 1993-1998 Russ Taylor * * ROM has been brought to you by the ROM consortium * * Russ Taylor (rtaylor@hypercube.org) * * Gabrielle Taylor (gtaylor@hypercube.org) * * Brian Moore (zump@rom.org) * * By using this code, you have agreed to follow the terms of the * * ROM license, in the file Rom24/doc/rom.license * *************************************************************************** * 1stMUD ROM Derivative (c) 2001-2002 by Ryan Jennings * * http://1stmud.dlmud.com/ <r-jenn@shaw.ca> * ***************************************************************************/ /* Online Social Editting Module, * (c) 1996,97 Erwin S. Andreasen <erwin@andreasen.org> * See the file "License" for important licensing information */ /* This version contains minor modifications to support ROM 2.4b4. */ #include <sys/types.h> #include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include "merc.h" #include "db.h" #include "olc.h" #include "recycle.h" #define SEDIT( fun ) bool fun( CHAR_DATA *ch, const char *argument ) /* Find a social based on name */ SOCIAL_DATA *social_lookup(const char *name) { SOCIAL_DATA *i; for (i = social_first; i; i = i->next) if (!str_cmp(name, i->name)) return i; return NULL; } /* * Social editting command */ SEDIT(sedit_show) { SOCIAL_DATA *pSocial; if (IS_NULLSTR(argument)) EDIT_SOCIAL(ch, pSocial); else pSocial = social_lookup(argument); if (pSocial == NULL) { chprintln(ch, "That social does not exist."); return FALSE; } chprintf(ch, "%s\n\r", stringf(ch, 0, ALIGN_CENTER, "-", FORMATF("[ %s: %s ]", olc_ed_name(ch), olc_ed_vnum(ch)))); chprintf(ch, "Name : %s\n\r" "(cnoarg): %s\n\r" "(onoarg): %s\n\r" "(cfound): %s\n\r" "(ofound): %s\n\r" "(vfound): %s\n\r" "(cself) : %s\n\r" "(oself) : %s\n\r", IS_STRSET(pSocial->name), IS_STRSET(pSocial->char_no_arg), IS_STRSET(pSocial->others_no_arg), IS_STRSET(pSocial->char_found), IS_STRSET(pSocial->others_found), IS_STRSET(pSocial->vict_found), IS_STRSET(pSocial->char_auto), IS_STRSET(pSocial->others_auto)); chprintln(ch, draw_line(ch, NULL, 0)); return TRUE; } SEDIT(sedit_delete) { SOCIAL_DATA *pSocial; if (IS_NULLSTR(argument)) EDIT_SOCIAL(ch, pSocial); else pSocial = social_lookup(argument); if (pSocial == NULL) { chprintln(ch, "No such social exists."); return FALSE; } unlink_social(pSocial); free_social(pSocial); edit_done(ch); chprintln(ch, "Social deleted."); return TRUE; } SEDIT(sedit_create) { SOCIAL_DATA *pSocial; char arg[MAX_INPUT_LENGTH]; argument = one_argument(argument, arg); if (IS_NULLSTR(arg)) { chprintln(ch, "Syntax: sedit create [social]"); return FALSE; } if (social_lookup(arg) != NULL) { chprintln(ch, "A social with that name already exists."); return FALSE; } pSocial = new_social(); replace_string(pSocial->name, arg); add_social(pSocial); edit_start(ch, pSocial, ED_SOCIAL); chprintln(ch, "Social created."); return TRUE; } void sedit(CHAR_DATA * ch, char *argument) { if (ch->pcdata->security < 5) { chprintln(ch, "SEdit: Insufficient security to modify socials."); edit_done(ch); } if (!str_cmp(argument, "done")) { edit_done(ch); return; } if (emptystring(argument)) { sedit_show(ch, ""); return; } if (!process_olc_command(ch, argument, social_olc_comm_table)) interpret(ch, argument); return; } CH_CMD(do_sedit) { SOCIAL_DATA *pSocial; char arg1[MAX_INPUT_LENGTH]; argument = one_argument(argument, arg1); if (IS_NPC(ch)) return; if (ch->pcdata->security < 5) { chprintln(ch, "Insuficient security to edit socials."); return; } if (!str_cmp(arg1, "show")) { if (IS_NULLSTR(argument)) { chprintln(ch, "Syntax: sedit show [social]"); return; } sedit_show(ch, ""); return; } if (!str_cmp(arg1, "create")) { if (IS_NULLSTR(argument)) { chprintln(ch, "Syntax: sedit create [social]"); return; } if (sedit_create(ch, argument)) { ch->desc->editor = ED_SOCIAL; act("$n has entered the social editor.", ch, NULL, NULL, TO_ROOM); } return; } if (!str_cmp(arg1, "delete")) { if (IS_NULLSTR(argument)) { chprintln(ch, "Syntax: sedit delete [social]"); return; } if (sedit_delete(ch, argument)) { return; } } if ((pSocial = social_lookup(arg1)) != NULL) { edit_start(ch, pSocial, ED_SOCIAL); return; } if (pSocial == NULL && !IS_NULLSTR(arg1)) { chprintln(ch, "That social does not exist."); return; } chprintln(ch, "SEdit: There is no default social to edit."); return; } SEDIT(sedit_name) { bool relocate; SOCIAL_DATA *psocial; char arg1[MIL]; EDIT_SOCIAL(ch, psocial); one_argument(argument, arg1); if (IS_NULLSTR(arg1)) { chprintln(ch, "Cannot clear name field!"); return FALSE; } if (arg1[0] != psocial->name[0]) { unhash_social(psocial); relocate = TRUE; } else relocate = FALSE; replace_string(psocial->name, arg1); if (relocate) hash_social(psocial); chprintln(ch, "Name set."); return TRUE; }