load/snoop/force, etc...

From: Crimson Wizard (cwizard@GIBLETS.COM)
Date: 08/08/97


Something dawned on me tonight while I was tinkering with do_snoop.... I
added on to the mudlog code to display a little more formatted message to
imms when something happens, then went on to log other things like loads
and snoops, etc... if you would like to see the code email me... but
anyways when you CALL mudlog(), one of the variables passed to it is
usually LVL_GOD or LVL_IMM... now.. that means that ANYONE that level or
higher sees what you did... say you want to be able to see when one of
your imms is loading eq? so you log it and display a pretty message with
mudlog(), but problem is when YOU load something everyone sees it.. simple
fix change those occurances to GET_LEVEL(ch).... easy :)

heres an example:

void implog(char *str, char type, int level, byte file)
{
  char buf[MAX_STRING_LENGTH];
  extern struct descriptor_data *descriptor_list;
  struct descriptor_data *i;
  char *tmp, tp;
  time_t ct;

  ct = time(0);
  tmp = asctime(localtime(&ct));

  if (file)
    fprintf(stderr, "%-19.19s :: %s\n", tmp, str);
  if (level < 0)
    return;

  sprintf(buf, "&n[&GImpInfo&n]: %s\r\n", str);

  for (i = descriptor_list; i; i = i->next)
    if (!i->connected && !PLR_FLAGGED(i->character, PLR_WRITING)) {
      tp = ((PRF_FLAGGED(i->character, PRF_LOG1) ? 1 : 0) +
            (PRF_FLAGGED(i->character, PRF_LOG2) ? 2 : 0));

      if ((GET_LEVEL(i->character) >= level) && (tp >= type)) {
        send_to_char(CCNRM(i->character, C_NRM), i->character);
        send_to_char(buf, i->character);
        send_to_char(CCNRM(i->character, C_NRM), i->character);
      }
    }
}


this is used in my snoop routine, here's another example:

   if (GET_LEVEL(tch) >= GET_LEVEL(ch)) {
      send_to_char("You can't.\r\n", ch);
      return;
    }
    send_to_char(OK, ch);
    sprintf(buf, "%s snoops %s", GET_NAME(ch), GET_NAME(victim));
    implog(buf, NRM, MAX(GET_LEVEL(ch), GET_INVIS_LEV(ch)), FALSE);

    if (ch->desc->snooping)
      ch->desc->snooping->snoop_by = NULL;

    ch->desc->snooping = victim->desc;
    victim->desc->snoop_by = ch->desc;
  }
}


you can see where a lvl 60 imp would not want all the lvl 55's or whatever
seeing his snoops.. etc... hope this helps someone.


--
#!/bin/sh
whois yea.com|grep YEA2|awk '{print $1}'
whois aree.com|grep DOM|awk '{print $1}'
whois aree.com|grep DOM|awk '{print $1}'|cut -c1
whois tm920|grep TM920|awk '{print $4}'|cut -d@ -f1


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST