head	1.0;
access;
symbols;
locks
	ntcommon:1.0; strict;
comment	@ * @;


1.0
date	95.12.17.19.47.28;	author ntcommon;	state Exp;
branches;
next	;


desc
@This is the first working netrek version, plasmas and other special weapons do not work.
@


1.0
log
@Initial revision
@
text
@/*
 * cluecheck.c
 * seperate file 01/04/93 isae
 */

#include "copyright.h"
#include <stdio.h>
#include <math.h>
#include "defs.h"
#include "struct.h"
#include "data.h"
#include "packets.h"

#define HIGHCLUE

#ifdef HIGHCLUE

struct Question {
  char *quest;
  char *help[5];
  char *answer;
  } ;

static struct Question clueWords[] = {

  {"What means a++ ?",
   {"a) Player a is a twink, I killed him two times in a row.",
    "b) Player a carries armies, please kill him now.",
    "c) Player a rewls, don't come close to him.",
    NULL },
   "b" },

  {"How many armies can a Starbase carry?",
   { NULL },
   "25" },

  {"Which ship can carry 3 armies per kill?",
   { "sc, dd, ca, as, bb ", NULL },
   "as" }

};

static struct Question *question;

#else
static char *clueWords[] = {
  "doorstop",
  "bronco",
  "plague",
  "moo",
  "transwarp",
  "guzzler",
  "calvin",
  "base",
  "iggy",
  "lock"
  };
#endif

save_armies()
{
  int i, k;

  k=10*(remap[me->p_team]-1);
  if (k>=0 && k<=30) for (i=0; i<10; i++) {
    if (planets[i+k].pl_owner==me->p_team) {
      planets[i+k].pl_armies += me->p_armies;
      pmessage(0, MALL, "GOD->ALL", "%s's %d armies placed on %s",
                     me->p_name, me->p_armies, planets[k+i].pl_name);
      break;
    }
  }
}

do_reminder()
{
  char **h;

  new_warning(UNDEF,"You have very important messages, Captain!");
  bounce(me->p_no,"************* READ THIS ** READ THIS ** READ THIS ******************");
  bounce(me->p_no,"This is a clue server, you MUST read messages on the game");
#ifdef HIGHCLUE
  bounce(me->p_no,"To verify, send the answer of the following question to yourself.");
  bounce(me->p_no,question->quest);
  for(h=question->help; *h; h++) bounce(me->p_no,*h);
#else
  bounce(me->p_no,"To verify, send the word '%s' to yourself. Thank you.", clueString);
#endif
  bounce(me->p_no,"********************************************************************");
}

clue_check()
{
  static int flag=0;
  int i;

  if ((me->p_status != PALIVE) && (me->p_status != POBSERV))  return;

  if (!flag) {

    if (!minRank && (me->p_stats.st_rank >= cluerank)){
      bounce(me->p_no," ");
      bounce(me->p_no,"Due to your rank, you're automatically verified.");
      bounce(me->p_no," ");
      clueVerified=1;
      clueFuse=0;
      clueCount=0;
      return;
    }
    if (CheckBypass(login,host,Clue_Bypass)) {
      bounce(me->p_no," ");
      bounce(me->p_no,"God has determined that you're not a twink. You've been verified.");
      bounce(me->p_no," ");
      clueVerified=1;
      clueFuse=0;
      clueCount=0;
      return;
    }
	
    i = (random() % (sizeof(clueWords) / sizeof(clueWords[0])));
/*    clueString = (char *) malloc(strlen(clueWords[i])+1); */
#ifdef HIGHCLUE
    question = &clueWords[i];
    clueString = clueWords[i].answer;
#else
    clueString = clueWords[i];
#endif
    do_reminder();
    flag=1;
  }

  /* We don't proceed if there is no wait-q */
  if (queues[QU_PICKUP].count == 0) return; 

  clueCount++;

  if ((clueCount % ONEMINUTE)==0) {
    do_reminder();
  }

  if (!clueVerified && (clueCount==THREEMINUTES)){
    new_warning(UNDEF,"You have been nuked as warning to read messages, Captain!");
    do_reminder();
    me->p_ship.s_type = STARBASE; 
    me->p_whydead=KPROVIDENCE;
    me->p_explode=10;
    me->p_status=PEXPLODE;
    me->p_whodead=0;
    pmessage(0, MALL, "GOD->ALL", 
	"%s (%2s) was nuked as a warning to read messages.",
        me->p_name, me->p_mapchars);
    if (me->p_armies>0) save_armies();
  }

  if (!clueVerified && (clueCount > FIVEMINUTES)) {
    new_warning(UNDEF,"Sorry, you have failed to verify. Read the MOTD");
    bounce(me->p_no,"You have been ejected from the game for not reading messages");
    bounce(me->p_no,"If you have any questions, send mail to the server admin.");
    me->p_whydead=KQUIT;
    me->p_explode=10;
    me->p_status=PEXPLODE;
    me->p_whodead=0;
    pmessage(0, MALL, "GOD->ALL", 
	"%s (%2s) has been ejected from the game for not reading msgs.",
        me->p_name, me->p_mapchars);
    if (me->p_armies>0) save_armies();
  }
}


@
