Exemplo n.º 1
0
 /* Accept an applicant into the clan */
 void do_caccept( struct char_data *ch, struct clan_type *cptr, struct char_data *vict )
 {
   int i=0;

   if (vict != NULL && (GET_CLAN(vict) < CLAN_MEMBER)) {
     GET_CLAN(vict)     = GET_CLAN(ch);
     GET_CLAN_RANK(vict) = CLAN_MEMBER;
     /* send some sort of mail to player notifying him/her of acceptance */
     sprintf(buf, "%s,\r\n\r\n"
       "   Congratulations!  You have been accepted into the ranks of\r\n"
       "%s.  The leader of our clan is %s.  Good luck.\r\n",
       GET_NAME(vict), cptr->name, cptr->leadersname);
     store_mail(GET_IDNUM(vict), GET_IDNUM(ch), -1, buf);
     /* now that the mail has been sent, let's continue. */
     GET_HOME(vict) = GET_HOME(ch);
     save_char(vict, NOWHERE);
     /* now remove the player from the petition list */
     remove_applicant(cptr, vict);

     for (i = 0; i < 100; i++)
     {
       if (cptr->members[i] == NULL)
       {
         cptr->members[i] = strdup(GET_NAME(vict));
         break;
       }
       if (strcmp(cptr->members[i], GET_NAME(vict)) == 0)
         break;  
     }

     save_clans();
   }
   return;
 }
Exemplo n.º 2
0
 /* Dismiss a member from the clan/Resign from the clan */
 void do_dismiss( struct char_data *ch, struct clan_type *cptr, struct char_data *vict )
 {
   if (vict != ch){
     if (vict != NULL && GET_CLAN(vict) == GET_CLAN(ch)) {
       if (GET_CLAN_RANK(vict) >= GET_CLAN_RANK(ch)) {
         send_to_char("You may not dismiss those of equal or greater clan status than yourself!\r\n", ch);
         return;
       }
     /* send some sort of mail to player notifying him/her of dismissal */
     sprintf(buf, "%s,\r\n\r\n"
       "   You have been dismissed from the clan of %s.\r\n"
       "If you are unsure of the reason why, please feel\r\n"
       "free to contact the leader, %s.\r\n",
       GET_NAME(vict), cptr->name, cptr->leadersname);
     store_mail(GET_IDNUM(vict), GET_IDNUM(ch), -1, buf);
     remove_member(cptr, vict);
     }
   } else if (GET_CLAN_RANK(vict) == CLAN_LEADER) {
     GET_CLAN_RANK(vict) = CLAN_MEMBER;
     send_to_char("You have resigned as leader.\r\n", ch);
     cptr->leadersname = strdup("NoOne");
     save_clans();
     return;
   }
   GET_CLAN(vict) = CLAN_NONE;
   GET_CLAN_RANK(vict) = CLAN_NONE;
   GET_HOME(vict) = 1;

   remove_member(cptr, vict);
   save_char(vict, NOWHERE);
   save_clans();
   return;
 }
Exemplo n.º 3
0
void
account_exhume_char(struct account *account, struct creature *exhumer, long id)
{
    if (player_idnum_exists(id)) {
        send_to_char(exhumer, "That character has already been exhumed.\r\n");
        return;
    }
    // load char from file
    struct creature *victim;
    
    victim = load_player_from_xml(id);
    if (victim) {
        sql_exec
            ("insert into players (idnum, account, name) values (%ld, %d, '%s')",
            GET_IDNUM(victim), account->id, tmp_sqlescape(GET_NAME(victim)));
        load_players(account);
        send_to_char(exhumer, "%s exhumed.\r\n",
            tmp_capitalize(GET_NAME(victim)));
        slog("%s[%ld] exhumed into account %s[%d]", GET_NAME(victim),
            GET_IDNUM(victim), account->name, account->id);
        free_creature(victim);
    } else {
        send_to_char(exhumer, "Unable to load character %ld.\r\n", id);
    }
}
Exemplo n.º 4
0
void
perform_pardon(struct creature *ch, struct creature *pardoned)
{
    for (GList *it = GET_GRIEVANCES(ch);it;it = it->next) {
        struct grievance *grievance = it->data;

        if (grievance->player_id == GET_IDNUM(pardoned)) {

            if (grievance->grievance == MURDER) {
                mudlog(LVL_IMMORT, CMP, true,
                    "%s recovered %d reputation for murdering %s",
                    GET_NAME(pardoned), grievance->rep, GET_NAME(ch));
            } else if (grievance->grievance == ATTACK) {
                mudlog(LVL_IMMORT, CMP, true,
                    "%s recovered %d reputation for attacking %s",
                    GET_NAME(pardoned), grievance->rep, GET_NAME(ch));
            } else {
                mudlog(LVL_IMMORT, CMP, true,
                    "%s recovered %d reputation for stealing from %s",
                    GET_NAME(pardoned), grievance->rep, GET_NAME(ch));
            }

            gain_reputation(pardoned, -(grievance->rep));
        }
    }

    GET_GRIEVANCES(ch) = g_list_remove_if(GET_GRIEVANCES(ch),
                                          (GCompareFunc) matches_grievance,
                                          GINT_TO_POINTER(GET_IDNUM(pardoned)));
}
Exemplo n.º 5
0
void notify_if_playing(struct char_data *from, int recipient_id) 
{ 
  struct descriptor_data *d; 

  for (d = descriptor_list; d; d = d->next) 
    if ((IS_PLAYING(d)) && (GET_IDNUM(d->character) == recipient_id) && (has_mail(GET_IDNUM(d->character)))) 
      send_to_char(d->character, "You have new mudmail from %s.\r\n", GET_NAME(from)); 
} 
Exemplo n.º 6
0
void
save_player_to_xml(struct creature *ch)
{
    char *path = get_player_file_path(GET_IDNUM(ch));

    if (GET_IDNUM(ch) == 0) {
        slog("Attempt to save creature with idnum==0");
        raise(SIGSEGV);
    }

    save_player_to_file(ch, path);
}
Exemplo n.º 7
0
static bool
dyntext_edit_ok(struct creature *ch, dynamic_text_file * dyntext)
{
    int i;

    if (dyntext->level <= GET_LEVEL(ch) || GET_IDNUM(ch) != 1)
        return 1;

    for (i = 0; i < DYN_TEXT_PERM_SIZE; i++) {
        if (dyntext->perms[i] == GET_IDNUM(ch))
            return 1;
    }

    return !already_being_edited(ch, dyntext->tmp_buffer);
}
Exemplo n.º 8
0
bool
summon_criminal_demons(struct creature *vict)
{
    struct creature *mob;
    int vnum_base = (IS_EVIL(vict)) ? ARCHONIC_BASE : DEMONIC_BASE;
    int demon_num = GET_REMORT_GEN(vict) / 2 + 1;
    int idx;

    for (idx = 0; idx < demon_num; idx++) {
        mob = read_mobile(vnum_base + MIN(4, (GET_LEVEL(vict) / 9))
            + number(0, 1));
        if (!mob) {
            errlog("Unable to load mob in demonic_overmind");
            return false;
        }
        start_hunting(mob, vict);
        SET_BIT(NPC_FLAGS(mob), NPC_SPIRIT_TRACKER);
        CREATE(mob->mob_specials.func_data, int, 1);
        *((int *)mob->mob_specials.func_data) = GET_IDNUM(vict);

        char_to_room(mob, vict->in_room, true);
        act("The air suddenly cracks open and $n steps out!", false,
            mob, NULL, NULL, TO_ROOM);
    }

    if (IS_EVIL(vict))
        mudlog(GET_INVIS_LVL(vict), NRM, true,
            "%d archons dispatched to hunt down %s",
            demon_num, GET_NAME(vict));
    else
        mudlog(GET_INVIS_LVL(vict), NRM, true,
            "%d demons dispatched to hunt down %s", demon_num, GET_NAME(vict));

    return true;
}
Exemplo n.º 9
0
bool
checkLoadCorpse(struct creature * ch)
{
    char *path = get_corpse_file_path(GET_IDNUM(ch));
    int axs = access(path, W_OK);
    struct stat file_stat;
    extern time_t boot_time;

    if (axs != 0) {
        if (errno != ENOENT) {
            errlog("Unable to open xml corpse file '%s' : %s",
                path, strerror(errno));
            return false;
        } else {
            return false;
        }
    }

    stat(path, &file_stat);

    if (file_stat.st_ctime < boot_time)
        return true;

    return false;
}
Exemplo n.º 10
0
int
loadCorpse(struct creature *ch)
{

    char *path = get_corpse_file_path(GET_IDNUM(ch));
    int axs = access(path, W_OK);
    struct obj_data *corpse_obj;

    if (axs != 0) {
        if (errno != ENOENT) {
            errlog("Unable to open xml corpse file '%s': %s",
                path, strerror(errno));
            return -1;
        } else {
            return 1;           // normal no eq file
        }
    }
    xmlDocPtr doc = xmlParseFile(path);
    if (!doc) {
        errlog("XML parse error while loading %s", path);
        return -1;
    }

    xmlNodePtr root = xmlDocGetRootElement(doc);
    if (!root) {
        xmlFreeDoc(doc);
        errlog("XML file %s is empty", path);
        return 1;
    }

    xmlNodePtr node = root->xmlChildrenNode;
    while (!xmlMatches(node->name, "object")) {
        node = node->next;
        if (node == NULL) {
            xmlFreeDoc(doc);
            errlog("First child in XML file (%s) not an object", path);
            return 1;
        }
    }

    corpse_obj = load_object_from_xml(NULL, ch, NULL, node);
    if (!corpse_obj) {
        xmlFreeDoc(doc);
        errlog("Could not create corpse object from file %s", path);
        return 1;
    }

    if (!IS_CORPSE(corpse_obj)) {
        xmlFreeDoc(doc);
        extract_obj(corpse_obj);
        errlog("First object in corpse file %s not a corpse", path);
        return 1;
    }

    xmlFreeDoc(doc);

    remove(path);
    return 0;
}
Exemplo n.º 11
0
static void postmaster_check_mail(struct char_data *ch, struct char_data *mailman,
			  int cmd, char *arg)
{
  if (has_mail(GET_IDNUM(ch)))
    act("$n tells you, 'You have mail waiting.'", FALSE, mailman, 0, ch, TO_VICT);
  else
    act("$n tells you, 'Sorry, you don't have any mail waiting.'", FALSE, mailman, 0, ch, TO_VICT);
}
Exemplo n.º 12
0
/*
 * get_ch_by_id: searches the character list for a pc
 */
struct char_data *get_ch_by_id(long idnum)
{
	struct char_data *tch;
	for (tch = character_list; tch; tch = tch->next)
		if (tch && !IS_NPC(tch) && GET_IDNUM(tch) == idnum)
			return (tch);
		
	return NULL;
}
Exemplo n.º 13
0
/*
 * get_ch_by_id_desc : given an ID number, searches every descriptor for a
 *             character with that number and returns a pointer to it.
 */
struct char_data *get_ch_by_id_desc(long idnum)
{
	struct descriptor_data *d;
	for (d = descriptor_list; d; d = d->next)
		if (d && d->character && GET_IDNUM(d->character) == idnum)
			return (d->character);
		
	return NULL;
}
Exemplo n.º 14
0
void perform_tell(CHAR_DATA * ch, CHAR_DATA * vict, char *arg)
{
// shapirus: не позволим телять, если жертва не видит и включила
// соответствующий режим; имморталы могут телять всегда
	if (PRF_FLAGGED(vict, PRF_NOINVISTELL)
			&& !CAN_SEE(vict, ch)
			&& GET_LEVEL(ch) < LVL_IMMORT
			&& !PRF_FLAGGED(ch, PRF_CODERINFO))
	{
		act("$N не любит разговаривать с теми, кого не видит.", FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP);
		return;
	}

	// TODO: если в act() останется показ иммов, то это и эхо ниже переделать на act()
	if (tell_can_see(ch, vict))
	{
		snprintf(buf, MAX_STRING_LENGTH, "%s сказал%s вам : '%s'", GET_NAME(ch), GET_CH_SUF_1(ch), arg);
	}
	else
	{
		snprintf(buf, MAX_STRING_LENGTH, "Кто-то сказал вам : '%s'", arg);
	}
	snprintf(buf1, MAX_STRING_LENGTH, "%s%s%s\r\n", CCICYN(vict, C_NRM), CAP(buf), CCNRM(vict, C_NRM));
	send_to_char(buf1, vict);
	if (!IS_NPC(vict))
	{
		vict->remember_add(buf1, Remember::ALL);
	}

	if (!IS_NPC(vict) && !IS_NPC(ch))
	{
		snprintf(buf, MAX_STRING_LENGTH, "%s%s : '%s'%s\r\n", CCICYN(ch, C_NRM),
				tell_can_see(ch, vict) ? GET_NAME(ch) : "Кто-то", arg, CCNRM(ch, C_NRM));
		vict->remember_add(buf, Remember::PERSONAL);
	}

	if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_NOREPEAT))
	{
		send_to_char(OK, ch);
	}
	else
	{
		snprintf(buf, MAX_STRING_LENGTH, "%sВы сказали %s : '%s'%s\r\n", CCICYN(ch, C_NRM),
				tell_can_see(vict, ch) ? vict->player_data.PNames[2] : "кому-то", arg, CCNRM(ch, C_NRM));
		send_to_char(buf, ch);
		if (!IS_NPC(ch))
		{
			ch->remember_add(buf, Remember::ALL);
		}
	}

	if (!IS_NPC(vict) && !IS_NPC(ch))
	{
		vict->set_answer_id(GET_IDNUM(ch));
	}
}
Exemplo n.º 15
0
/* make ch remember victim */
void remember(struct char_data * ch, struct char_data * victim)
{
  memory_rec *tmp;
  bool present = FALSE;

  if (!IS_NPC(ch) || IS_NPC(victim) || (GET_LEVEL(victim) >= LVL_IMMORT))
    return;

  for (tmp = MEMORY(ch); tmp && !present; tmp = tmp->next)
    if (tmp->id == GET_IDNUM(victim))
      present = TRUE;

  if (!present) {
    CREATE(tmp, memory_rec, 1);
    tmp->next = MEMORY(ch);
    tmp->id = GET_IDNUM(victim);
    MEMORY(ch) = tmp;
  }
}
Exemplo n.º 16
0
/* make ch remember victim */
void remember(struct char_data *ch, struct char_data *victim)
{
  memory_rec *tmp;
  bool present = FALSE;

  if (!IS_NPC(ch) || IS_NPC(victim) || PRF_FLAGGED(victim, PRF_NOHASSLE))
    return;

  for (tmp = MEMORY(ch); tmp && !present; tmp = tmp->next)
    if (tmp->id == GET_IDNUM(victim))
      present = TRUE;

  if (!present) {
    CREATE(tmp, memory_rec, 1);
    tmp->next = MEMORY(ch);
    tmp->id = GET_IDNUM(victim);
    MEMORY(ch) = tmp;
  }
}
Exemplo n.º 17
0
struct char_data *find_hunted_char(int idnum)
{
  struct char_data *tmp;
  struct char_data *tmp_next;
  for (tmp = character_list; tmp; tmp = tmp_next) {
    tmp_next = tmp->next;
    if (GET_IDNUM(tmp) == idnum && !IS_AFFECTED(tmp, AFF_NOTRACK))
      return tmp;
  }
  return NULL;
}
Exemplo n.º 18
0
/* note: arg passed must be house vnum, so there. */
int House_can_enter(struct char_data * ch, room_vnum house)
{
  int i, j;

  if (GET_LEVEL(ch) >= LVL_BUILDER || (i = find_house(house)) < 0)
    return 1;

  switch (house_control[i].mode) {
  case HOUSE_PRIVATE:
    if (GET_IDNUM(ch) == house_control[i].owner)
      return 1;
    for (j = 0; j < house_control[i].num_of_guests; j++)
      if (GET_IDNUM(ch) == house_control[i].guests[j])
	return 1;
    return 0;
    break;
  }

  return 0;
}
Exemplo n.º 19
0
void postmaster_check_mail(struct char_data * ch, struct char_data *mailman,
			  int cmd, char *arg)
{
  char buf[256];

  if (has_mail(GET_IDNUM(ch)))
    sprintf(buf, "$n tells you, 'You have mail waiting.'");
  else
    sprintf(buf, "$n tells you, 'Sorry, you don't have any mail waiting.'");
  act(buf, FALSE, mailman, 0, ch, TO_VICT);
}
Exemplo n.º 20
0
 /* Reject an applicant from a clan/Withdraw an application */
 void do_creject( struct char_data *ch, struct clan_type *cptr, struct char_data *vict)
 {
   int i=0;
   long leader;
 
   if (vict != ch) {
     if (vict != NULL) {
       /* send some sort of mail to player notifying him/her of rejection */
       sprintf(buf, "%s,\r\n\r\n"
         "   You have been rejected from the clan of %s.\r\n"
         "If you are unsure of the reason why, please feel\r\n"
         "free to contact the leader, %s.\r\n",
         GET_NAME(vict), cptr->name, cptr->leadersname);
       store_mail(GET_IDNUM(vict), GET_IDNUM(ch), -1, buf);
       /* mail's been sent, let's move on */
     }
   } else {
       for (i=0; i<20; i++) {
         if (!str_cmp(cptr->applicants[i], GET_NAME(ch))) {
           send_to_char("You aren't applying to the clan...\r\n", ch);
           break;
         }
       }
 
       /* send some sort of mail to leader notifying him/her of withdrawal */
       leader = get_id_by_name(cptr->leadersname);
       sprintf(buf, "%s,\r\n\r\n"
         "   I have withdrawn my application from the clan.\r\n"
         "\r\n%s\r\n",
         cptr->leadersname, GET_NAME(ch));
       store_mail(leader, GET_IDNUM(ch), -1, buf);
       /* now that the mail has been sent, let's continue. */
   }
   GET_CLAN(vict) = CLAN_NONE;
   GET_CLAN_RANK(vict) = 0;
   save_char(vict, NOWHERE);
   /* now remove the player from the petition list */
   remove_applicant(cptr, vict);
   save_clans();
   return;
 }
Exemplo n.º 21
0
static int
push_update_to_history(struct creature *ch, dynamic_text_file * dyntext)
{
    for (int i = DYN_TEXT_HIST_SIZE - 1; i > 0; i--)
        dyntext->last_edit[i] = dyntext->last_edit[i - 1];

    dyntext->last_edit[0].idnum = GET_IDNUM(ch);
    dyntext->last_edit[0].tEdit = time(NULL);

    return 0;

}
Exemplo n.º 22
0
void
postmaster_receive_mail (struct char_data *ch, struct char_data *mailman,
						 int cmd, char *arg)
{
	char buf[256];
	struct obj_data *obj;

	if (!has_mail (GET_IDNUM (ch)))
	{
		sprintf (buf,
				 "$n tells you, 'Sorry, you don't have any mail waiting.'");
		act (buf, FALSE, mailman, 0, ch, TO_VICT);
		return;
	}
	while (has_mail (GET_IDNUM (ch)))
	{
		obj = create_obj ();
		obj->item_number = NOTHING;
		obj->name = str_dup ("mail paper letter");
		obj->short_description = str_dup ("a piece of mail");
		obj->description = str_dup ("Someone has left a piece of mail here.");

		GET_OBJ_TYPE (obj) = ITEM_NOTE;
		GET_OBJ_WEAR (obj) = ITEM_WEAR_TAKE | ITEM_WEAR_HOLD;
		GET_OBJ_WEIGHT (obj) = 1;
		GET_OBJ_COST (obj) = 30;
		GET_OBJ_RENT (obj) = 10;
		obj->action_description = read_delete (GET_IDNUM (ch));

		if (obj->action_description == NULL)
			obj->action_description =
				str_dup
				("Mail system error - please report.  Error #11.\r\n");

		obj_to_char (obj, ch);

		act ("$n gives you a piece of mail.", FALSE, mailman, 0, ch, TO_VICT);
		act ("$N gives $n a piece of mail.", FALSE, ch, 0, mailman, TO_ROOM);
	}
}
Exemplo n.º 23
0
void chkmaster(struct char_data *ch)
{
  struct char_data *masterplayer, *next_ch;

  if ((!ch->master) && (GET_MOB_SAVED_MASTER(ch) != -1))
  for (masterplayer = character_list; masterplayer; masterplayer = next_ch) {
 	  next_ch = masterplayer->next;
	  if (   masterplayer 
	      && !IS_NPC(masterplayer) 
	      && (GET_MOB_SAVED_MASTER(ch)==GET_IDNUM(masterplayer)) )
 		  add_follower(ch, masterplayer);
  }
}
Exemplo n.º 24
0
void
create_grievance(struct creature *ch,
    struct creature *perp, int gain, enum grievance_kind kind)
{
    struct grievance *grievance;

    CREATE(grievance, struct grievance, 1);
    grievance->time = time(NULL);
    grievance->player_id = GET_IDNUM(perp);
    grievance->rep = gain;
    grievance->grievance = kind;
    GET_GRIEVANCES(ch) = g_list_prepend(GET_GRIEVANCES(ch), grievance);
}
Exemplo n.º 25
0
void
gen_board_remove(struct board_data *board, struct creature *ch, char *argument)
{
    struct creature *player;
    PGresult *res;
    int idx;

    if (IS_PC(ch))
        player = ch;
    else if (ch->desc && ch->desc->original)
        player = ch->desc->original;
    else {
        send_to_char(ch, "You're a mob.  Go awei.\r\n");
        return;
    }

    idx = atoi(argument) - 1;
    if (idx < 0) {
        send_to_char(ch, "That is not a valid message.\r\n");
        return;
    }
    // First we find the idnum of the thing we want to destroy
    res =
        sql_query
        ("select idnum, author from board_messages where board='%s' order by idnum limit 1 offset %d",
        tmp_sqlescape(board->name), idx);

    if (PQntuples(res) != 1) {
        send_to_char(ch, "That posting doesn't exist!\r\n");
        return;
    }

    if (ALLOW != react(board->read_perms, player)
        || ALLOW != react(board->post_perms, player)) {
        send_to_char(ch, "%s\r\n", board->deny_remove);
        return;
    }

    if (GET_IDNUM(player) != atol(PQgetvalue(res, 0, 1)) &&
        ALLOW != react(board->remove_perms, player)) {
        send_to_char(ch, "%s\r\n", board->not_author);
        return;
    }

    sql_exec("delete from board_messages where idnum=%s",
        PQgetvalue(res, 0, 0));

    act("$n rips a post off of the board.", true, ch, NULL, NULL, TO_ROOM);
    send_to_char(ch, "The posting was deleted.\r\n");
}
Exemplo n.º 26
0
int Valid_Name(char *newname)
{
  int i, wovels = 0;
  struct descriptor_data *dt;
  char tempname[MAX_INPUT_LENGTH];

  /*
   * Make sure someone isn't trying to create this same name.  We want to
   * do a 'str_cmp' so people can't do 'Bob' and 'BoB'.  The creating login
   * will not have a character name yet and other people sitting at the
   * prompt won't have characters yet.
   *
   * New, unindexed characters (i.e., characters who are in the process of creating)
   * will have an idnum of -1, set by clear_char() in db.c.  If someone is creating a
   * character by the same name as the one we are checking, then the name is invalid,
   * to prevent character duping.
   * THIS SHOULD FIX THE 'invalid name' if disconnected from OLC-bug - WELCOR 9/00
   */
  for (dt = descriptor_list; dt; dt = dt->next)
    if (dt->character && GET_NAME(dt->character) && !str_cmp(GET_NAME(dt->character), newname))
      if (GET_IDNUM(dt->character) == -1)
        return (IS_PLAYING(dt));

  /* count wovels */
  for (i = 0; newname[i]; i++) {
    if (strchr("aeiouyAEIOUY", newname[i]))
      wovels++;
  }

  /* return invalid if no wovels */
  if (!wovels)
    return (0);

  /* return valid if list doesn't exist */
  if (!invalid_list || num_invalid < 1)
    return (1);

  /* change to lowercase */
  strlcpy(tempname, newname, sizeof(tempname));
  for (i = 0; tempname[i]; i++)
    tempname[i] = LOWER(tempname[i]);

  /* Does the desired name contain a string in the invalid list? */
  for (i = 0; i < num_invalid; i++)
    if (strstr(tempname, invalid_list[i]))
      return (0);

  return (1);
}
Exemplo n.º 27
0
void
gen_board_save(struct creature *ch, const char *board, int idnum,
    const char *subject, const char *body)
{
    if (idnum < 0)
        sql_exec
            ("insert into board_messages (board, post_time, author, name, subject, body) values ('%s', now(), %ld, '%s', '%s', '%s')",
            tmp_sqlescape(board), GET_IDNUM(ch),
            tmp_sqlescape(tmp_capitalize(GET_NAME(ch))),
            tmp_sqlescape(subject), tmp_sqlescape(body));
    else
        sql_exec
            ("update board_messages set post_time=now(), subject='%s', body='%s' where idnum=%d",
            tmp_sqlescape(subject), tmp_sqlescape(body), idnum);
}
Exemplo n.º 28
0
 /* Apply to a clan for membership */
 void do_apply( struct char_data *ch, struct clan_type *cptr )
 {
   int i;
   long leader;

   if (IS_NPC(ch))
     return;

   if (!strcmp(cptr->leadersname, "NoOne") ) 
   {
     send_to_char("The clan is currently without a leader.\r\n", ch);
     return;
   }

   for (i = 0; i < 20; i++) {
     if (cptr->applicants[i] == NULL)
       break;
     if (!strcmp(cptr->applicants[i], GET_NAME(ch))) {
       send_to_char("You have already applied to this clan.\r\n", ch);
       return;
     }
   }
     if ((cptr->applicants[i] == NULL) && (i < 20)) {
       cptr->applicants[i] = str_dup(GET_NAME(ch));
       save_clans();
       /* send some sort of mail to leader notifying him/her of application */
       leader = get_id_by_name(cptr->leadersname);
       sprintf(buf, "%s,\r\n\r\n"
         "   Hi there!  I'd like to apply to your clan.  I have some abilities\r\n"
         "that I feel will be useful to you.  Please feel free to contact me \r\n"
         "for any information that you might need about me.\r\n"
         "Hope to hear from you soon!\r\n"
         "\r\n%s\r\n",
         cptr->leadersname, GET_NAME(ch));
       store_mail(leader, GET_IDNUM(ch), -1, buf);
       /* now that the mail has been sent, let's continue. */
       sprintf(buf, "Your application for admittance to %s has been noted.\r\n"
         "You will receive notification when you have been accepted.\r\n",
         cptr->name);
       send_to_char(buf, ch);
     } else
       send_to_char("This clan is already being applied to by 20 other players, try again later.\r\n", ch);
     save_clans();
     return;

 }
Exemplo n.º 29
0
void perform_tell(struct char_data *ch, struct char_data *vict, char *arg)
{
  struct descriptor_data *i;

  send_to_char(CCRED(vict, C_NRM), vict);
  sprintf(buf, "$n tells you, '%s'", arg);
  if (GET_LEVEL(ch) >= LVL_IMMORT)
    sprintf(buf1, "%s tells you, '%s'", CAN_SEE(vict, ch) ? GET_NAME(ch) : "An Immortal", arg);
  else
    sprintf(buf1, "%s tells you, '%s'", CAN_SEE(vict, ch) ? GET_NAME(ch) : "Someone", arg);

  logthistory(buf1, vict);

  act(buf, FALSE, ch, 0, vict, TO_VICT | TO_SLEEP);
  send_to_char(CCNRM(vict, C_NRM), vict);

  if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_NOREPEAT))
    send_to_char(OK, ch);
  else {
    send_to_char(CCRED(ch, C_CMP), ch);
    sprintf(buf, "You tell $N, '%s'", arg);
    if (GET_LEVEL(vict) < LVL_IMMORT)
      sprintf(buf1, "You tell %s, '%s'", CAN_SEE(ch, vict) ? GET_NAME(vict) : "Someone",arg);
    else
      sprintf(buf1, "You tell %s, '%s'", CAN_SEE(ch, vict) ? GET_NAME(vict) : "An Immortal",arg);

    logthistory(buf1, ch);
    act(buf, FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP);
    send_to_char(CCNRM(ch, C_CMP), ch);
  }

   for (i = descriptor_list; i; i = i->next)
     if (STATE(i) == CON_PLAYING && i != ch->desc && i != vict->desc &&
       PRF_FLAGGED2(i->character, PRF2_HEARALLTELL) && 
       GET_LEVEL(i->character) == LVL_IMPL && !IS_NPC(ch) && !IS_NPC(vict)) 
       {
    	send_to_char(CCRED(i->character, C_CMP), i->character);
   	sprintf(buf, ">> %s tells %s, '%s'\r\n", GET_NAME(ch), GET_NAME(vict), arg);
	send_to_char(buf, i->character);
        send_to_char(CCNRM(i->character, C_CMP), i->character);
       }
  if (!IS_NPC(vict) && !IS_NPC(ch))
    GET_LAST_TELL(vict) = GET_IDNUM(ch);
}
Exemplo n.º 30
0
static void perform_tell(struct char_data *ch, struct char_data *vict, char *arg)
{
  char buf[MAX_STRING_LENGTH], *msg;

  snprintf(buf, sizeof(buf), "%s$n tells you, '%s'%s", CCRED(vict, C_NRM), arg, CCNRM(vict, C_NRM));
  msg = act(buf, FALSE, ch, 0, vict, TO_VICT | TO_SLEEP);
  add_history(vict, msg, HIST_TELL);

  if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_NOREPEAT))
    send_to_char(ch, "%s", CONFIG_OK);
  else {
    snprintf(buf, sizeof(buf), "%sYou tell $N, '%s'%s", CCRED(ch, C_NRM), arg, CCNRM(ch, C_NRM));
    msg = act(buf, FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP);     
    add_history(ch, msg, HIST_TELL);
  }

  if (!IS_NPC(vict) && !IS_NPC(ch))
    GET_LAST_TELL(vict) = GET_IDNUM(ch);
}