Exemplo n.º 1
0
void 
set_initial_hp (CHAR_DATA * ch)
{
  int init_hp;
  int init_mp;
  if (IS_MOB (ch))
    {
      init_hp = pow.initial_hp[0] / 2;	/* Take into account mobs are usually */
      init_mp = (pow.initial_mv[0] * 2) / 3;	/* Higher level */
    }
  else
    {
      if (ch->pcdata->remort_times > 0)
	{
	  init_hp = number_range (pow.remort_hp[0], pow.remort_hp[1]);
	  init_mp = number_range (pow.remort_mv[0], pow.remort_mv[1]);
	}
      else
	{
	  init_hp = number_range (pow.initial_hp[0], pow.initial_hp[1]);
	  init_mp = number_range (pow.initial_mv[0], pow.initial_mv[1]);
	}
    }

  ch->max_hit = init_hp;
  ch->max_move = init_mp;
  if (IS_MOB (ch) || pow.restore_when_level)
    {
      MAXHIT(ch);
      MAXMOVE(ch);
    }
  return;
}
Exemplo n.º 2
0
char *
how_good (CHAR_DATA *ch, int gsn)
{
  static char bf[256];
  int i;
  int learned = 0;
  SPELL_DATA *spl;
  bf[0] = '\0';
  if (IS_MOB(ch)) 
    {
      strcpy (bf, "No Mobs Plz");
      return bf;
    }
  
  if ((spl = skill_lookup(NULL, gsn)) == NULL)
    {
      strcpy (bf, "No spell!");
      return (bf);
    }
  else
    {
      if (learned != 100)
	learned = ch->pcdata->learned[gsn];
      for (i = 0; i < 20; i++)
	{
	  if (pow.learned[i] != NULL && learned >= pow.low_range[i] && learned <= pow.high_range[i])
	    {
	      strcpy (bf, pow.learned[i]);
	      return (bf);
	    }
	}
    }
return bf;
}
Exemplo n.º 3
0
void
do_sforce (CHAR_DATA * ch, char *argy)
{
  char person[100];
  DESCRIPTOR_DATA *d;
  CHAR_DATA *vict;
  DEFINE_COMMAND ("sforce", do_sforce, POSITION_DEAD, MAX_LEVEL, LOG_ALWAYS, "This command forces a character to do something, yet redirects output to your console instead of the character's.")

    person[0] = '\0';
  argy = one_argy (argy, person);
  if (person[0] == '\0')
    {
      send_to_char ("Reminder: DON'T use this command if you don't know what you're doing! :)\n\r", ch);
      return;
    }
  if ((vict = get_char_world (ch, person)) == NULL || IS_MOB (vict))
    {
      send_to_char ("Target sforce not found.\n\r", ch);
      return;
    }
  d = vict->desc;
  vict->desc = ch->desc;
  interpret (vict, argy);
  if (vict->data_type == 50)
    return;
  vict->desc = d;
  return;
}
Exemplo n.º 4
0
 /*Mob Go - Patrol by Lance*/
 void go_patrol_activity(int pulse)
 {
  register struct char_data *ch, *next_ch;
  //extern int no_specials;

  for (ch = character_list; ch; ch = next_ch) {
 	 next_ch = ch->next;

 	 if (!IS_MOB(ch))
 	  continue;

 	  /* If the mob has no specproc, do the default actions */
 	 if (FIGHTING(ch) || !AWAKE(ch))
 		continue;

 	 if (MOB_FLAGGED(ch , MOB_SEARCHER)) {

 		if (MOB_FLAGGED(ch , MOB_GO_FAST)) {
 			if (!(pulse % (2 * PASSES_PER_SEC)))
 			  perform_go(ch);
 		} else {
 		  if (!(pulse % (4 * PASSES_PER_SEC)))
 			perform_go(ch);
 		}
 	}
   }//for
 }
Exemplo n.º 5
0
int max_learn_skill(struct char_data *ch,int skill)
{
  skill_entry *sk;
  if (IS_MOB(ch)) return(100);
  sk=find_skill_entry(ch,skill);
  if (!sk) return(0); else return(sk->max_learn);
}
Exemplo n.º 6
0
int max_learn_spell(struct char_data *ch, int spell)
{
  spell_entry *sp;
  if (IS_MOB(ch)) return(100);
  sp=find_spell_entry(ch,spell);
  if (!sp) return(0); else return(sp->max_learn);
}
Exemplo n.º 7
0
void do_new_prereq (CHAR_DATA *ch, char *argy)
{
  SPELL_DATA *spell;
  int i;

  DEFINE_COMMAND ("zprerequisite", do_new_prereq, POSITION_DEAD, 0, LOG_NORMAL, "Allows you to see prerequisites to the skill-big tree format.")
    
    if (IS_MOB (ch))
      return;
  for (i = 0; i < 100; i ++)
    vert_line[i] = FALSE;
   for (i = 0; i < SKILL_COUNT; i++)
    used_spell[i] = FALSE;
 
  
  if (argy[0] == '\0' || (spell = skill_lookup (argy, -1)) == NULL)
    {
      send_to_char ("Syntax: Prereq <skill/spell/prof name>\n\r", ch);
      return;
    }
  xprereq(ch, spell);
  

  /* Now clean up our static bool */
 
  return;
}
Exemplo n.º 8
0
bool 
is_member (CHAR_DATA * ch, int guildflag)
{
  if (IS_MOB (ch)) 
    return TRUE; /* JRAJRA - Changed this from FALSE mobs are now 
	always guild members when we are talking about spellcasting. */
  if (IS_SET (ch->pcdata->guilds, guildflag))
    return TRUE;
  else
    return FALSE;
}
Exemplo n.º 9
0
void
drawstuff (CHAR_DATA *ch, char* argy, int maxy, int maxx)
{
  char *y = argy;
  char tt[50];
  int i,j,m;
  if (IS_MOB(ch)) return;
  if (IS_SET(ch->pcdata->act2, PLR_NOIBM))
    noibm = TRUE;
  else 
    noibm = FALSE;
  flip = FALSE;
  kk = FALSE;
  mb = FALSE;
  for (; *y != '\0'; y++)
    {
      if (*y == 'N' || *y == 'n')
	noibm = TRUE;
      if (*y == 'D' || *y == 'd')
	kk = TRUE;
      if (*y == 'M' || *y == 'm')
	mb = TRUE;
      if (*y == 'F' || *y == 'f')
	flip = TRUE;
    }
  for (i=0; i<80; i++)
    {
      for (j=0; j<25; j++)
	{
	  outp[i][j][0] = ' ';
	  outp[i][j][1] = '\0';
	  for (m=0; m < 15; m++)
	    scrnn[i][j][m]='\0';
	  colrs[i][j]='\0';
	}
    }
  reset_data();
  ch->pcdata->maxx = maxx;
  ch->pcdata->maxy = maxy;
  go_display (ch, ch->in_room, (maxx/2), (maxy/2), maxy, maxx);
  outp[(maxx/2)][(maxy/2)][0] = 'X';
  outp[(maxx/2)][(maxy/2)][1] = '\0';
  draw_data (ch, maxy);
  write_to_buffer(ch->desc, "\x1B[0;37m", 0);
  gotoxy (ch, 1, maxy+1);
  undisplay(ch, ch->in_room, 150); 
  gotoxy(ch, 1, ch->pcdata->pagelen);
  mb = FALSE;
  kk = FALSE;
  noibm = FALSE;
  flip = FALSE;
  return;
}
Exemplo n.º 10
0
/* (RR) Anche questa come sopra rifarla con la data di inizio gioco.
 * Ritorna le ore giocate da un pg.
 */
int get_hours_played( CHAR_DATA *ch )
{
	if ( !ch )
	{
		send_log( NULL, LOG_BUG, "get_hours_played: ch è NULL" );
		return 0;
	}

	if ( IS_MOB(ch) )
		return 0;

	return ( ch->pg->played + (current_time - ch->pg->logon) ) / 3600;
}
Exemplo n.º 11
0
SPEC_RET spec_thief( CHAR_DATA *ch )
{
	CHAR_DATA *victim;
	CHAR_DATA *v_next;
	int		   gold;
	int		   maxgold;

	if ( ch->position != POSITION_STAND )
		return FALSE;

	for ( victim = ch->in_room->first_person;  victim;  victim = v_next )
	{
		v_next = victim->next_in_room;

		if ( IS_MOB(victim) )			continue;
		if ( IS_ADMIN(victim) )			continue;
		if ( number_bits(2) != 0 )		continue;
		if ( !can_see(ch, victim) )		continue;

		if ( is_awake(victim) && number_range(0, get_level(ch)/2) == 0 )
		{
			act( AT_ACTION, "$n mi sta derubando! Dannato ladro!",
				ch, NULL, victim, TO_VICT	 );
			if ( get_curr_sense(ch, SENSE_SIXTH) > 75 )
			{
				act( AT_ACTION, "Mi accorgo che $n sta frugando nel suo sacco di monete di $N!",
					ch, NULL, victim, TO_NOVICT );
			}
		}
		else
		{
			maxgold = get_level(ch)/2 * get_level(ch)/2 * 1000;
			gold = victim->gold * number_range( 1, URANGE(2, get_level(ch)/8, 10) ) / 100;
			ch->gold += 9 * gold / 10;
			victim->gold -= gold;

			if ( ch->gold > maxgold )
			{
				boost_economy( ch->in_room->area, ch->gold - maxgold/2 );
				ch->gold = maxgold/2;
			}
		}
		return TRUE;
	} /* chiude il for */

	return FALSE;
}
Exemplo n.º 12
0
void free_char( CHAR_DATA *ch )
{
	OBJ_DATA	*obj;
	OBJ_DATA	*obj_next;
	AFFECT_DATA *paf;
	AFFECT_DATA *paf_next;
	/*~~~~~~~~~~~~~~~~~~*/

	if ( !IS_VALID(ch) )
		return;

	if ( IS_MOB(ch) )
		mobile_count--;

	ch->extracted = TRUE;
	for ( obj = ch->carrying; obj != NULL; obj = obj_next )
	{
		obj_next = obj->next_content;
		extract_obj_nocount( obj );
	}

	for ( paf = ch->affected; paf != NULL; paf = paf_next )
	{
		paf_next = paf->next;
		affect_remove( ch, paf );
	}

	free_string( ch->name );
	free_string( ch->short_descr );
	free_string( ch->long_descr );
	free_string( ch->description );
	free_string( ch->prompt );
	free_string( ch->prefix );
	free_string( ch->material );
	free_string( ch->in_mind );

	if ( ch->pcdata != NULL )
		free_pcdata( ch->pcdata );

	ch->next = char_free;
	char_free = ch;

	ch->extracted = FALSE;
	INVALIDATE( ch );
}
Exemplo n.º 13
0
void log_action(struct char_data *ch, char *arg)
{
  char prefix[5];

  if (IS_MOB(ch)) return;
  if (GetMaxLevel(ch)>=IMMORTAL)
    strcpy(prefix,"IMM:");
  else
    strcpy(prefix,"PLR:");
  fprintf(player_log,"%s%s:%s\n",prefix,GET_NAME(ch),arg);
  if (IS_SET(ch->specials.act,PLR_LOG) && strlen(arg)>2) {
    if (GET_LEVEL(ch)>=IMMORTAL)
      vlog(LOG_IMMSPY,"%s:%s",GET_NAME(ch),arg);
    else
      vlog(LOG_MORTSPY,"%s:%s",GET_NAME(ch),arg);
  }
  fflush(player_log);
}
Exemplo n.º 14
0
void
do_beep (CHAR_DATA * ch, char *argy)
{
  CHAR_DATA *vict;
  char beep_string[500];
  DEFINE_COMMAND ("beep", do_beep, POSITION_DEAD, IMM_LEVEL, LOG_NORMAL, "This command sends a beep from one immort to a player/other immort.")

    if ((vict = get_char_world (ch, argy)) == NULL)
    {
      send_to_char ("Player not found.\n\r", ch);
      return;
    }
  if (IS_MOB (vict))
    return;
  sprintf (beep_string, "%c%c%c%c%cBeep sent from %s to %s!\n\r", 7, 7, 7, 7, 7, NAME (ch), NAME (vict));
  send_to_char (beep_string, vict);
  send_to_char (beep_string, ch);
  return;
}
Exemplo n.º 15
0
bool is_in_olc( DESCRIPTOR_DATA *d )
{
	if ( !d )
		return FALSE;

	if ( !d->character || IS_MOB(d->character) )
		return FALSE;

	/* objs */
	if ( d->connected == CON_OEDIT )
		return TRUE;
	/* mobs */
	if ( d->connected == CON_MEDIT  )
		return TRUE;
	/* rooms */
	if ( d->connected == CON_REDIT )
		return TRUE;

	return FALSE;
}
Exemplo n.º 16
0
void 
do_prereqs (CHAR_DATA * ch, char *argy)
{
  char buf[STD_LENGTH];
  SPELL_DATA *spell;
  DEFINE_COMMAND ("prereqs", do_prereqs, POSITION_DEAD, 0, LOG_NORMAL, "Allows you to see prerequisites to the specified skill or spell.")

    if (IS_MOB (ch))
    return;
  if (argy[0] == '\0' || (spell = skill_lookup (argy, -1)) == NULL)
    {
      send_to_char (
		     "Syntax: Prereq <skill/spell/prof name>\n\r", ch);
      return;
    }

  if (spell->prereq_1 != NULL && spell->prereq_2 != NULL)
    {
      sprintf (buf,
	       "\x1B[1m%s\x1B[0m has two prerequisites: \x1B[1;36m%s\x1B[37;0m and \x1B[1;36m%s\x1B[37;0m.\n\r",
	       spell->spell_funky_name, spell->prereq_1, spell->prereq_2);
      send_to_char (buf, ch);
      return;
    }

  if (spell->prereq_1 != NULL)
    {
      sprintf (buf,
      "\x1B[1m%s\x1B[0m has only one prerequisite: \x1B[1;36m%s\x1B[0m.\n\r",
	       spell->spell_funky_name, spell->prereq_1);
      send_to_char (buf, ch);
      return;
    }

  sprintf (buf,
	   "\x1B[1m%s\x1B[0m has no prerequisites whatsoever.\n\r",
	   spell->spell_funky_name);
  send_to_char (buf, ch);
  return;
}
Exemplo n.º 17
0
/* (RR) con l'età iniziale scelta dal giocatore e la divisione del return differente basata sul nostro time
 * Ritorna l'età di un giocatore.
 */
int get_age( CHAR_DATA *ch, int type )
{
	if ( !ch )
	{
		send_log( NULL, LOG_BUG, "get_age: ch è NULL" );
		return 17;
	}

	if ( IS_MOB(ch) )
		return 17;

	switch ( type )
	{
	  default:
		send_log( NULL, LOG_BUG, "tipo di unità temporale errata per %s: %d", ch->name, type );
		return 17;

	  case TIME_YEAR:	return 17 + (  (current_time - ch->pg->creation_date) / SECONDS_IN_YEAR );						break;
	  case TIME_MONTH:	return  1 + ( ((current_time - ch->pg->creation_date) / SECONDS_IN_MONTH) % MONTHS_IN_YEAR );	break;
	  case TIME_DAY:	return  1 + ( ((current_time - ch->pg->creation_date) / SECONDS_IN_YEAR ) % DAYS_IN_MONTH  );	break;
	}
}
Exemplo n.º 18
0
/*
 * Log all changes to catch those sneaky bastards =)
 */
void olc_log( DESCRIPTOR_DATA *d, char *format, ... )
{
	ROOM_DATA	*room	= d->character->dest_buf;
	OBJ_DATA	*obj	= d->character->dest_buf;
	CHAR_DATA	*victim = d->character->dest_buf;
	char		 logline[MSL];
	char		 log_buf[MSL];
	va_list		 args;

	if ( !d )
	{
		send_log( NULL, LOG_OLC, "olc_log: called with null descriptor" );
		return;
	}

	va_start( args, format );
	vsprintf( logline, format, args );
	va_end( args );

	if		( d->connected == CON_REDIT )
		sprintf( log_buf, "%s ROOM(%d): ", d->character->name, room->vnum );
	else if ( d->connected == CON_OEDIT )
		sprintf( log_buf, "%s OBJ(%d): ", d->character->name, obj->vnum );
	else if ( d->connected == CON_MEDIT )
	{
		if ( IS_MOB(victim) )
			sprintf( log_buf, "%s MOB(%d): ", d->character->name, victim->pIndexData->vnum );
		else
			sprintf( log_buf, "%s PLR(%s): ", d->character->name, victim->name );
	}
	else
	{
		send_log( NULL, LOG_OLC, "olc_log: called with a bad connected state: %d", d->connected );
		return;
	}

	send_log( NULL, LOG_OLC, "olc_log: %s%s", log_buf, logline );
}
Exemplo n.º 19
0
/*
 * Procedura centrale per i dragoni.
 */
bool dragon( CHAR_DATA *ch, char *spell_name )
{
	CHAR_DATA *victim;
	CHAR_DATA *v_next;
	int		   sn;

	if ( ch->position != POSITION_FIGHT
	  && ch->position != POSITION_EVASIVE
	  && ch->position != POSITION_DEFENSIVE
	  && ch->position != POSITION_AGGRESSIVE
	  && ch->position != POSITION_BERSERK )
	{
		return FALSE;
	}

	for ( victim = ch->in_room->first_person;  victim;  victim = v_next )
	{
		v_next = victim->next_in_room;

		if ( who_fighting(victim) != ch )	continue;
		if ( number_bits(2) )				continue;

		if ( IS_PG(victim) )
			break;
		if ( IS_MOB(victim) && HAS_BIT(victim->affected_by, AFFECT_CHARM) )
			break;
	}

	if ( !victim )
		return FALSE;

	sn = skill_lookup( spell_name );
	if ( sn < 0 )
		return FALSE;

	(*table_skill[sn]->spell_fun) ( sn, get_level(ch)/2, ch, victim );
	return TRUE;
}
Exemplo n.º 20
0
int
find_char_mana (CHAR_DATA * ch, int bit, int sn)
{
  SINGLE_OBJECT *gem;
  int mana = 0;
  SPELL_DATA *spell = NULL;
  int level = 0;
  if (IS_MOB(ch) || LEVEL(ch) >= 100) return 500;
  spell = skill_lookup (NULL, sn);
  level = (is_member(ch, GUILD_WIZARD) ? 1 : 0)+
    (is_member(ch, GUILD_HEALER) ? 1 : 0)+
    (is_member(ch, GUILD_MYSTIC) ? 1 : 0)+
    (is_member(ch, GUILD_CONJURER) ? 1: 0);
  if (IS_AUGMENTED(ch, AUG_CHANNEL))
    {
      level *=2;
      level +=2;
    }
  level += ((get_curr_int (ch) + get_curr_wis (ch)) / 2) +(ch->pcdata->remort_times+1);
   if (ch->pcdata->n_mana < 0) ch->pcdata->n_mana = 0;
  mana = ch->pcdata->n_mana;
  if ((gem = ch->hold1) != NULL && gem->pIndexData->item_type == ITEM_GEM && IS_SET(((I_GEM *) gem->more)->gem_type, bit))
    {
      mana += ((I_GEM *)gem->more)->mana_now;
      level += ((I_GEM *)gem->more)->max_level;
    }
  else if ((gem = ch->hold2) != NULL && gem->pIndexData->item_type == ITEM_GEM && IS_SET(((I_GEM *) gem->more)->gem_type, bit))
    {
      mana += ((I_GEM *)gem->more)->mana_now;
      level += ((I_GEM *)gem->more)->max_level;
    }
  if (spell->spell_level > level)
    {
      send_to_char("You cannot cast this spell without the proper type of gem!\n\r", ch);
      return 0;
    }
  return mana;
}
Exemplo n.º 21
0
void
small_map (CHAR_DATA *ch)
{
  int i,j;
  if (IS_MOB(ch)) return;
  if (IS_SET(ch->pcdata->act2, PLR_NOIBM)) noibm = TRUE;
  if (IS_SET(ch->pcdata->act2, PLR_VIEWMOBS)) mb = TRUE;
  if (IS_SET(ch->pcdata->act2, PLR_VIEWPLAYERS)) kk = TRUE;
  for (i=0; i < MAP_WIDTH; i++)
    {
      for (j=0; j < MAP_HEIGHT; j++)
	{
	  smlmap[i][j][0] = ' ';
	  smlmap[i][j][1] = '\0';
	  smlcolors[i][j]= 0;
	}
    }
  reset_small();
  ch->pcdata->x = (MAP_WIDTH/2);
  ch->pcdata->y = (MAP_HEIGHT/2);
  if (noibm)
    sml_noibm(ch, ch->in_room,MAP_WIDTH/2, MAP_HEIGHT/2);
  else
    sml_ibm(ch, ch->in_room, MAP_WIDTH/2, MAP_HEIGHT/2);
  smlmap[MAP_WIDTH/2][MAP_HEIGHT/2][0] = 'X';
  smlmap[MAP_WIDTH/2][MAP_HEIGHT/2][1] = '\0';
  smlcolors[MAP_WIDTH/2][MAP_HEIGHT/2] = 12;  
  draw_small (ch);
  write_to_buffer(ch->desc, "\x1B[0;37m", 0);
  undisplay(ch, ch->in_room, 50); 
  gotoxy(ch, 1, ch->pcdata->pagelen);
  mb = FALSE;
  noibm = FALSE;
  kk = FALSE;
  return;
}
Exemplo n.º 22
0
void
sml_noibm (CHAR_DATA * ch, ROOM_DATA * rid, int x, int y)
{
  int i, newx = x, newy = y;
  bool found = FALSE;
  if (x > MAP_WIDTH || x < 0) /* Boundary x case stop */
    return;
  if (y > MAP_HEIGHT || y < 0) /* Boundary y case stop */
    return;
  if (rid->y) return; /* Don't do same room twice. */
  rid->y = TRUE;
  smlcolors[x][y] = rid->color;
  if (rid->more && kk && rid->more->pcs > 0)
    {
      CHAR_DATA *rch;
      for(rch = rid->more->people; rch != NULL; rch=rch->next_in_room)
        {
         if(IS_PLAYER(rch) && !DIFF_ALIGN(ch,rch))
           {
         smlmap[x][y][0] = 'P';
         smlcolors[x][y] = 12;
         found = TRUE;
         break;
          }
       }
    }
  if (!found && rid->more && mb && rid->more->people > 0)
    {
       CHAR_DATA *rch;
       for (rch = rid->more->people; rch != NULL; rch =rch->next_in_room)
        {
          if (IS_MOB(rch))
            {
              found = TRUE;
          smlmap[x][y][0] = 'M';
	  smlcolors[x][y] = 9;
              break;
            }
	}
    }
  if (!found)
	{
	  smlmap[x][y][0] = rid->noibm[0];
	}
 
   for (i = 0; i < 4; i ++)
     {
	if (rid->mapexit[i])
	  {
	    if ((i % 2) == 0) 
               newy += (i-1); 
	     else 
	       newx += (2-i);
	      sml_noibm(ch, rid->mapexit[i], newx, newy);
	      newy = y;
	      newx = x;
	 }
     }
  
  return;
}
Exemplo n.º 23
0
void 
do_guild (CHAR_DATA * ch, char *argy)
{
  
  int i;
  CHAR_DATA *mob;
  char buf[STD_LENGTH];
  char arg1[SML_LENGTH];
  DEFINE_COMMAND ("guild", do_guild, POSITION_STANDING, 0, LOG_NORMAL, "This command allows you to perform guild options at a guild house.")
    if (IS_MOB (ch))
      return;
  argy = one_argy(argy, arg1);
  if (!str_cmp (arg1, "info") || !str_cmp(arg1, "cost") || !str_cmp(arg1,
								    "costs"))
    {
      show_guild_costs(ch, "");
      return;
    }		

  for (mob = ch->in_room->more->people; mob != NULL; mob = mob->next_in_room)
    {
      if (IS_MOB (mob) && (
	   IS_SET (mob->pIndexData->act3, ACT3_TINKER)
	   || IS_SET (mob->pIndexData->act3, ACT3_WARRIOR)
	   || IS_SET (mob->pIndexData->act3, ACT3_HEALER)
	   || IS_SET (mob->pIndexData->act3, ACT3_WIZARD)
	   || IS_SET (mob->pIndexData->act3, ACT3_THIEFG)
	   || IS_SET (mob->pIndexData->act3, ACT3_RANGER)
	   || IS_SET (mob->pIndexData->act3, ACT3_ROGUE)
	   || IS_SET (mob->pIndexData->act3, ACT3_MYSTIC)
	   || IS_SET (mob->pIndexData->act3, ACT3_CONJURER)
	   || IS_SET (mob->pIndexData->act3, ACT3_BATTLEMASTER)
	   || IS_SET (mob->pIndexData->act3, ACT3_NECROMANCER)
	   || IS_SET (mob->pIndexData->act3, ACT3_MONK)
	   )
	  )
	break;
    }
  if (mob == NULL)
    {
      send_to_char ("There is no guildmaster present here!\n\r", ch);
      return;
    }
  if (arg1[0] == '\0')
    {
      send_to_char ("\n\rOptions:\n\r---> Guild leave\n\r---> Guild info\n\r---> Guild join\n\r---> Guild status\n\r", ch);
      return;
    }
  
  /*end of GUILD INFO */
  if (!str_cmp (arg1, "status"))
    {
      if (!IS_SET (ch->pcdata->guilds, (mob->pIndexData->act3)))
	{
	  send_to_char ("You are not a member of our guild!\n\r", ch);
	  return;
	}
      send_to_char ("You are an highly respected member of the guild.\n\r", ch);
      return;
    }				/*end of GUILD STATUS */
  
  
  if (!str_cmp (arg1, "leave"))
    {
      
      if (!is_member (ch, (mob->pIndexData->act3)))
	{
	  send_to_char ("You aren't even a member!!\n\r", ch);
	  return;
	}
      for (i = 0; str_cmp(guild_data[i].what_you_type, "end_of_list"); i++)
	{
	  if (IS_SET(mob->pIndexData->act3, guild_data[i].mob_guildmaster_bit))
	    {
	      ch->pcdata->stat[guild_data[i].stat_modified]--;
	      REMOVE_BIT(ch->pcdata->guilds, guild_data[i].player_guild_bit);
	      send_to_char("You are no longer a member of the guild.", ch);
	      player_preset(ch, "Zlughlkheyn");
              do_remove(ch, "all");
	      break;
	    }
	}
    }
  /*end of GUILD LEAVE */
  if (!str_cmp(arg1, "replace"))
    {
      char arg2[STD_LENGTH];
      char arg3[STD_LENGTH];
      int oldnum = -1;
      int newnum = -1;
      
      argy = one_argy(argy, arg2);
      argy = one_argy(argy, arg3);
      if (arg2[0] == '\0' || arg3[0] == '\0')
	{
	  send_to_char("Syntax: Guild Replace <old_guild> <new_guild>\n\r", ch);
	  return;
	}
      for (i = 0; str_cmp(guild_data[i].what_you_type, "end_of_list"); i++)
	{
	  if (!str_cmp(guild_data[i].what_you_type, arg2))
	    {
	      oldnum = guild_data[i].mob_guildmaster_bit;
	      break;
	    }
	}
      for (i = 0; str_cmp(guild_data[i].what_you_type, "end_of_list"); i++)
	{
	  if (!str_cmp(guild_data[i].what_you_type, arg3))
	    {
	      newnum = guild_data[i].mob_guildmaster_bit;
	      break;
	    }
	}
      if (oldnum == -1 || newnum == -1)
	{
	  send_to_char("You need to check those names again. I don't know which guilds you are talking about.\n\r", ch);
	  return;
	}
      if (!IS_SET(ch->pcdata->guilds, oldnum))
	{
	  send_to_char("You don't have that guild so how do you expect to replace it?\n\r", ch);
	  return;
	}
      if (newnum == oldnum)
	{
	  send_to_char("You are not changing anything!! Get a clue.\n\r", ch);
	  return;
	}
      if (!IS_SET(mob->pIndexData->act3, newnum))
	{
	  send_to_char("This guildmaster cannot add you. You must find the proper guildmaster for the guild you wish to join.\n\r", ch);
	  return;
	}
      if (is_member(ch, newnum))
	{
	  send_to_char("You are already a member of that guild!\n\r", ch);
	  return; 
	}
      if (ch->pcdata->bank < 60000)
	{
	  send_to_char("You need 60000 coins in the bank for this to be done.\n\r", ch);
	  return;
	}
      if(ch->pcdata->warpoints < 100)
	{
	  send_to_char("You need 100 warpoints for this to be done.\n\r", ch);
	  return;
	}
      ch->pcdata->bank -= 60000;
      ch->pcdata->warpoints -= 100;
      for (i = 0; str_cmp(guild_data[i].what_you_type, "end_of_list"); i++)
	{
	  if (IS_SET(oldnum, guild_data[i].mob_guildmaster_bit))
	    {
	      ch->pcdata->stat[guild_data[i].stat_modified]--;
	      REMOVE_BIT(ch->pcdata->guilds, guild_data[i].player_guild_bit);
	      break;
	    }
	}
      for (i = 0; str_cmp(guild_data[i].what_you_type, "end_of_list"); i++)
	{
	  if (IS_SET(newnum, guild_data[i].mob_guildmaster_bit))
	    {
	      ch->pcdata->stat[guild_data[i].stat_modified]++;
	      SET_BIT(ch->pcdata->guilds, guild_data[i].player_guild_bit);
	      break;
	    }
	}
      sprintf(buf, "Congratulations! You are now a member of the %s!\n\r", guild_data[i].what_you_see);
      send_to_char(buf, ch);
      sprintf (buf, "Welcome to our guild, %s!", NAME (ch));
      do_say (mob, buf); 
      player_preset(ch, "Zlughlkheyn");
      fix_char(ch);
      send_to_char("Ok, the guilds have been switched.\n\r", ch);
      return;
    }
  if (!str_cmp (arg1, "join"))
    {
      int num = get_num_guilds(ch);
      int remorts = pow.guild_info[num][0];
      int lvl = pow.guild_info[num][1];
      int cst = (pow.guild_info[num][2] * 100);
      int wps = pow.guild_info[num][3];
      int kps = pow.guild_info[num][4];
      bool can_join = TRUE;
      if (IS_SET (ch->pcdata->guilds, mob->pIndexData->act3 ))
	{
	  send_to_char ("You are already a member of our guild!\n\r", ch);
	  return;
	}
      if (ch->pcdata->remort_times < remorts)
	{
	  sprintf (buf, "You need to have at least %d remorts to join this guild!\n\r", remorts);
	  send_to_char (buf, ch);
	  can_join = FALSE;
	}
      // Commented out because i replaced it with the code below.
        /* if (LEVEL (ch) < lvl)
	{
	  sprintf (buf, "You need to be level %d to join the guild!\n\r", lvl);
	  send_to_char (buf, ch);
	  can_join = FALSE;
	}*/
      //Added so if the player has a remort that they can join even if they don't meet the level req.
      //Sabelis 1-18-2006
      if ((LEVEL (ch) >lvl) || (ch->pcdata->remort_times>0))
          {
          can_join = TRUE;
          }
      else if (LEVEL (ch) < lvl)
        {
          sprintf (buf, "You need to be level %d to join the guild!\n\r", lvl);
          send_to_char (buf, ch);
          can_join = FALSE;
        }

      if (tally_coins (ch) < cst)
	{
	  sprintf (buf, "We need a payment of %d coins before we can let you join.\n\r", cst);
	  send_to_char (buf, ch);
	  can_join = FALSE;
	}
      if (ch->pcdata->warpoints < wps)
	{
	  sprintf (buf, "You need to have at least %d warpoints to join this guild!\n\r", wps);
	  send_to_char (buf, ch);
	  can_join = FALSE;
	}
      if (ch->pcdata->killpoints < kps)
	{
	  sprintf (buf, "You need to have at least %d killpoints to join this guild!\n\r", kps);
	  send_to_char (buf, ch);
	  can_join = FALSE;
	}
      if (!can_join)
	return;
      
      ch->pcdata->warpoints -= wps;
      ch->pcdata->killpoints -= kps;
      sub_coins (cst, ch);
      for (i = 0; str_cmp(guild_data[i].what_you_type, "end_of_list"); i++)
	{
	  if (IS_SET(mob->pIndexData->act3, guild_data[i].mob_guildmaster_bit))
	    {
	      ch->pcdata->stat[guild_data[i].stat_modified]++;
	      SET_BIT(ch->pcdata->guilds, guild_data[i].player_guild_bit);
	      break;
	    }
	}
      sprintf(buf, "Congratulations! You are now a member of the %s!\n\r", guild_data[i].what_you_see);
      send_to_char(buf, ch);
      sprintf (buf, "Welcome to our guild, %s!", NAME (ch));
      do_say (mob, buf);
    }
  return;
}
Exemplo n.º 24
0
int shop_keeper(struct char_data *ch, int cmd, char *arg)
{
	char argm[100], buf[MAX_STRING_LENGTH];
	struct obj_data *temp1;
	struct char_data *temp_char;
	struct char_data *keeper;
	int shop_nr;

	keeper = 0;

	for (temp_char = world[ch->in_room].people; (!keeper) && (temp_char) ; 
		temp_char = temp_char->next_in_room)
	if (IS_MOB(temp_char))
		if (mob_index[temp_char->nr].func == shop_keeper)
			keeper = temp_char;

	for(shop_nr=0 ; shop_index[shop_nr].keeper != keeper->nr; shop_nr++);

	if((cmd == 56) && (ch->in_room == 
	   real_room(shop_index[shop_nr].in_room)))
	 /* Buy */
	{
		shopping_buy(arg,ch,keeper,shop_nr);
		return(TRUE);
	}

	if((cmd ==57 ) && (ch->in_room == 
	   real_room(shop_index[shop_nr].in_room)))
	 /* Sell */
	{
		shopping_sell(arg,ch,keeper,shop_nr);
		return(TRUE);
	}

	if((cmd == 58) && (ch->in_room == 
	   real_room(shop_index[shop_nr].in_room)))
	 /* value */
	{
		shopping_value(arg,ch,keeper,shop_nr);
		return(TRUE);
	}

	if((cmd == 59) && (ch->in_room == 
	   real_room(shop_index[shop_nr].in_room)))
	 /* List */
	{
		shopping_list(arg,ch,keeper,shop_nr);
		return(TRUE);
	}

	if ((cmd == 25) || (cmd==70))   /* Kill or Hit */
	{
		one_argument(arg, argm);

		if (keeper == get_char_room(argm,ch->in_room))
		{
			shopping_kill(arg,ch,keeper,shop_nr);
			return(TRUE);
		}
	} else if ((cmd==84) || (cmd==207) || (cmd==172)) {   /* Cast, recite, use */
		act("$N tells you 'No magic here - kid!'.", FALSE, ch, 0, keeper, TO_CHAR);
    return TRUE;
	}

	return(FALSE);
}
Exemplo n.º 25
0
int shop_keeper(struct char_data *ch, int cmd, const char *arg, char *mob, int type)
{
  char argm[100];
  struct char_data *temp_char;
  struct char_data *keeper;
  int shop_nr;
  
  int citizen(struct char_data *ch, int cmd, const char *arg, struct char_data *mob, int type);

  if(type == EVENT_DWARVES_STRIKE) {
    ch->generic = DWARVES_STRIKE;
    return FALSE;
  }

  if(type == EVENT_FAMINE) {
    ch->generic = FAMINE;
    return FALSE;
  }

  keeper = 0;
  
  for (temp_char = real_roomp(ch->in_room)->people; (!keeper) && (temp_char) ; 
       temp_char = temp_char->next_in_room)
    if (IS_MOB(temp_char))
      if (mob_index[temp_char->nr].func == CASTVF shop_keeper)
        keeper = temp_char;
  
  
  
  for(shop_nr=0 ; shop_index[shop_nr].keeper != keeper->nr; shop_nr++);
  
  
  if (!cmd) {
    if (keeper->specials.fighting) {
      return(citizen(keeper,0,"", keeper,0));
    }
  }
  
  if((cmd == 56) && (ch->in_room == shop_index[shop_nr].in_room))
    /* Buy */
    {
      shopping_buy(arg,ch,keeper,shop_nr);
      return(TRUE);
    }
  
  if((cmd ==57 ) && (ch->in_room == shop_index[shop_nr].in_room))
    /* Sell */
    {
      shopping_sell(arg,ch,keeper,shop_nr);
      return(TRUE);
    }
  
  if((cmd == 58) && (ch->in_room == shop_index[shop_nr].in_room))
    /* value */
    {
      shopping_value(arg,ch,keeper,shop_nr);
      return(TRUE);
    }
  
  if((cmd == 59) && (ch->in_room == shop_index[shop_nr].in_room))
    /* List */
    {
      shopping_list(arg,ch,keeper,shop_nr);
      return(TRUE);
    }
  
  if ((cmd == 25) || (cmd==70))   /* Kill or Hit */
    {
      only_argument(arg, argm);
      
      if (keeper == get_char_room(argm,ch->in_room))
        {
          shopping_kill(arg,ch,keeper,shop_nr);
          return(TRUE);
        }
    } else 
    if ((cmd==84) || (cmd==207) || (cmd==172) || (cmd==283) || (cmd==370) ) {   /* Cast, recite, use */
      act("$N tells you 'No magic or mistical powers here - kid!'.", FALSE, ch, 0, keeper, TO_CHAR);
      return TRUE;
    }
  
  return(FALSE);
}
Exemplo n.º 26
0
void 
do_note (CHAR_DATA * ch, char *argy)
{
  char buf[STD_LENGTH * 17];
  char buf1[STD_LENGTH * 17];
  char arg[SML_LENGTH];
  NOTE_DATA *pnote;
  int vnum;
  int board_here;		/*Boards and board nums by Owen Emlen */
  SINGLE_OBJECT *obj;
  int anum;
  DEFINE_COMMAND ("note", do_note, POSITION_DEAD, 0, LOG_NORMAL, "This command is used to post/read/remove notes.")

    if (IS_MOB (ch))
    return;
  board_here = 0;
  obj = get_obj_here (ch, "board", SEARCH_ROOM_FIRST);
  if (obj == NULL)
    {
      board_here = 1;
    }
  else
    board_here = obj->pIndexData->value[9];
  buf1[0] = '\0';
  argy = one_argy (argy, arg);
  smash_tilde (argy);
  if (arg[0] == '\0')
    {
      do_note (ch, "read");
      return;
    }
  if (!str_cmp (arg, "list"))
    {
      vnum = 0;
      
 	sprintf(buf1,"\x1B[1;30m------------------------------------------------------------------------\x1B[37;0m\n\r");
      sprintf(buf1+strlen(buf1),"\x1B[1;36m New  ###  Sender/From         Subject\x1B[37;0m\n\r");
	sprintf(buf1+strlen(buf1),"\x1B[1;30m------------------------------------------------------------------------\x1B[37;0m\n\r");

      for (pnote = note_list; pnote != NULL; pnote = pnote->next)
	{
	  if (is_note_to (ch, pnote) &&
	      (board_here == pnote->board_num || IS_IMMORTAL (ch)))
	    {
		  if (strlen(pnote->subject)>35) {
			pnote->subject[35]='\0';
			}
	      sprintf (buf, "%s \x1B[1;36m%3d\x1B[37;0m  From \x1b[1;37m%-14s\x1B[37;0m '\x1B[1;36m%s\x1B[37;0m'\n\r",
		       (pnote->date_stamp > ch->pcdata->last_note
			&& str_cmp (pnote->sender, NAME (ch))) ? "\x1B[1;34m(New)\x1B[37;0m" : "     ",
		       vnum,
		pnote->sender, pnote->subject);
	      strcat (buf1, buf);
	      vnum++;
	    }
	  else
	    vnum++;
	  if (strlen (buf1) > (STD_LENGTH * 16))
	    {
	      strcat (buf1, "\n\rTOO MANY NOTES.. WAIT UNTIL A GOD REMOVES SOME!\n\r");
	      break;
	    }
	}
      page_to_char_limited (buf1, ch); 
      return;
    }
  if (!str_cmp (arg, "read"))
    {
      bool fAll;
      if (!str_cmp (argy, "all"))
	{
	  fAll = TRUE;
	  anum = 0;
	}
      else if (argy[0] == '\0' || !str_prefix (argy, "next"))
	/* read next unread note */
	{
	  vnum = 0;
	  for (pnote = note_list; pnote != NULL; pnote = pnote->next)
	    {
	      if (is_note_to (ch, pnote) &&
		  (board_here == pnote->board_num || IS_IMMORTAL (ch))
		  && str_cmp (NAME (ch), pnote->sender)
		  && ch->pcdata->last_note < pnote->date_stamp)
		{
		  sprintf (buf,"\x1B[1;30m---------------------------------------------------------------------------\x1B[37;0m\n\r");
		  sprintf (buf+strlen(buf), "[Note #\x1B[1;37m%d:%d\x1B[37;0m] From: \x1B[1;37m%s\x1B[37;0m  To: \x1B[1;37m%s\x1B[37;0m\n\r",
			   vnum,
			   pnote->board_num,
			   pnote->sender,
			   pnote->to_list);
		  if (strlen(pnote->subject)>35) {
			pnote->subject[35]='\0';
			}
		  sprintf (buf+strlen(buf),"%s.  Subject: \x1B[1;36m%s\x1B[37;0m\n\r",
			   pnote->date,
			   pnote->subject);
		  sprintf (buf+strlen(buf),"\x1B[1;30m---------------------------------------------------------------------------\x1B[37;0m\n\r");
		  strcat (buf1, buf);
		  strcat (buf1, pnote->text);
		  ch->pcdata->last_note = UMAX (ch->pcdata->last_note, pnote->date_stamp);
		
                  page_to_char_limited (buf1, ch); 
		  return;
		}
	      else
		vnum++;
	    }
	  send_to_char ("You have no unread notes.\n\r", ch);
	  return;
	}
      else if (is_number (argy))
	{
	  fAll = FALSE;
	  anum = atoi (argy);
	}
      else
	{
	  send_to_char ("Note read which number?\n\r", ch);
	  return;
	}
      vnum = 0;
      for (pnote = note_list; pnote != NULL; pnote = pnote->next)
	{
	  if ((vnum++ == anum || fAll) && is_note_to (ch, pnote) &&
	      (board_here == pnote->board_num || IS_IMMORTAL (ch)))
	    {
		  sprintf (buf,"\x1B[1;30m---------------------------------------------------------------------------\x1B[37;0m\n\r");
		  sprintf (buf+strlen(buf), "[Note #\x1B[1;37m%d:%d\x1B[37;0m] From: \x1B[1;37m%s\x1B[37;0m  To: \x1B[1;37m%s\x1B[37;0m\n\r",
			   vnum - 1,
			   pnote->board_num,
			   pnote->sender,
			   pnote->to_list);
		  if (strlen(pnote->subject)>35) {
			pnote->subject[35]='\0';
			}
		  sprintf (buf+strlen(buf),"Dated %s.  Subject: \x1B[1;36m%s\x1B[37;0m\n\r",
			   pnote->date,
			   pnote->subject);
		  sprintf (buf+strlen(buf),"\x1B[1;30m---------------------------------------------------------------------------\x1B[37;0m\n\r");
	      strcat (buf1, buf);
	      strcat (buf1, pnote->text);
	  
              page_to_char_limited (buf1, ch); 
	      return;
	    }
	}
      send_to_char ("No such note.\n\r", ch);
      return;
    }
  if (!str_cmp (arg, "write"))
    {
      if (LEVEL (ch) < IMM_LEVEL && board_here == 1)
	{
	  send_to_char ("You can't write on the immortal notice board.\n\r", ch);
	  return;
	}
      if (IS_SET(ch->act, PLR_LAMER))
	{
	  send_to_char("You have lost your board writing privileges.\n\r", ch);
	  send_to_char("Maybe if you grow up you will be allowed to start\n\r", ch);
	  send_to_char("posting on the board again, however since you have\n\r", ch);
	  send_to_char("consistently shown yourself to be lame this is not likely.\n\r", ch);
	  return;
	}
      check_ced (ch);
      note_attach (ch);
      string_append (ch, &ch->ced->pnote->text);
      return;
    }
  if (!str_cmp (arg, "fwrite"))
    {
      if (IS_SET(ch->act, PLR_LAMER))
	{
	  send_to_char("You have lost your board writing privileges.\n\r", ch);
	  send_to_char("Maybe if you grow up you will be allowed to start\n\r", ch);
	  send_to_char("posting on the board again, however since you have\n\r", ch);
	  send_to_char("consistently shown yourself to be lame this is not likely.\n\r", ch);
	  return;
	}
      if (LEVEL (ch) < IMM_LEVEL && board_here == 1)
	{
	  send_to_char ("You can't write on the immortal notice board.\n\r", ch);
	  return;
	}
      check_ced (ch);
      note_attach (ch);
      fullscreen_editor (ch, &ch->ced->pnote->text);
      return;
    }

  if (!str_cmp (arg, "+"))
    {
      
      check_ced (ch);
      note_attach (ch);
      strcpy (buf, ch->ced->pnote->text);
      if (strlen (buf) + strlen (argy) >= STD_LENGTH - 200)
	{
	  send_to_char ("Note too long.\n\r", ch);
	  return;
	}
      strcat (buf, argy);
      strcat (buf, "\n\r");
      free_string (ch->ced->pnote->text);
      ch->ced->pnote->text = str_dup (buf);
      ch->ced->pnote->lines += 1;
      send_to_char ("Ok.\n\r", ch);
      return;
    }  
  if (!str_cmp (arg, "-"))
    {
      int num, cnt;
      char new_buf[STD_LENGTH];
      const char *str;
      check_ced (ch);
      if (ch->ced->pnote == NULL)
	{
	  send_to_char ("You have to start a note first.\n\r", ch);
	  return;
	}
      if (ch->ced->pnote->lines == 0)
	{
	  send_to_char ("Nothing to delete.\n\r", ch);
	  return;
	}
      new_buf[0] = '\0';
      str = ch->ced->pnote->text;
      cnt = 1;
      for (num = 1; num <= ch->ced->pnote->lines; num++)
	{
	  while (*str != '\r' && *str != '\0')
	    {
	      ++str;
	      ++cnt;
	    }
	}
      strncpy (new_buf, ch->ced->pnote->text, cnt);
      new_buf[cnt] = '\0';
      free_string (ch->ced->pnote->text);
      ch->ced->pnote->text = str_dup (new_buf);
      ch->ced->pnote->lines -= 1;
      send_to_char ("Ok.\n\r", ch);
      return;
    }
  if (!str_cmp (arg, "subject"))
    {
      if (IS_SET(ch->act, PLR_LAMER))
	{
	  send_to_char("You have lost your board writing privileges.\n\r", ch);
	  send_to_char("Maybe if you grow up you will be allowed to start\n\r", ch);
	  send_to_char("posting on the board again, however since you have\n\r", ch);
	  send_to_char("consistently shown yourself to be lame this is not likely.\n\r", ch);
	  return;
	}
      check_ced (ch);
      note_attach (ch);
      free_string (ch->ced->pnote->subject);
      ch->ced->pnote->subject = str_dup (argy);
      send_to_char ("Ok.\n\r", ch);
      return;
    }
  if (!str_cmp (arg, "to"))
    {
      if (IS_SET(ch->act, PLR_LAMER))
	{
	  send_to_char("You have lost your board writing privileges.\n\r", ch);
	  send_to_char("Maybe if you grow up you will be allowed to start\n\r", ch);
	  send_to_char("posting on the board again, however since you have\n\r", ch);
	  send_to_char("consistently shown yourself to be lame this is not likely.\n\r", ch);
	  return;
	}
      check_ced (ch);
      note_attach (ch);
      free_string (ch->ced->pnote->to_list);
      ch->ced->pnote->to_list = str_dup (argy);
      send_to_char("\x1b[1;31mBe sure to put 'pkill' or 'flame' if this is a pkill flame note.\x1b[0;37m", ch);
      send_to_char ("Ok.\n\r", ch);
      return;
    }
  if (!str_cmp (arg, "clear"))
    {
      if (IS_SET(ch->act, PLR_LAMER))
	{
	  send_to_char("You have lost your board writing privileges.\n\r", ch);
	  send_to_char("Maybe if you grow up you will be allowed to start\n\r", ch);
	  send_to_char("posting on the board again, however since you have\n\r", ch);
	  send_to_char("consistently shown yourself to be lame this is not likely.\n\r", ch);
	  return;
	}
      check_ced (ch);
      if (ch->ced->pnote != NULL)
	{
	  free_string (ch->ced->pnote->text);
	  free_string (ch->ced->pnote->subject);
	  free_string (ch->ced->pnote->to_list);
	  free_string (ch->ced->pnote->date);
	  free_string (ch->ced->pnote->sender);
	  ch->ced->pnote->next = note_free;
	  note_free = ch->ced->pnote;
	  ch->ced->pnote = NULL;
	}
      send_to_char ("Ok.\n\r", ch);
      return;
    }
  if (!str_cmp (arg, "show"))
    {
      if (IS_SET(ch->act, PLR_LAMER))
	{
	  send_to_char("You have lost your board writing privileges.\n\r", ch);
	  send_to_char("Maybe if you grow up you will be allowed to start\n\r", ch);
	  send_to_char("posting on the board again, however since you have\n\r", ch);
	  send_to_char("consistently shown yourself to be lame this is not likely.\n\r", ch);
	  return;
	}
      check_ced (ch);
      if (ch->ced->pnote == NULL)
	{
	  send_to_char ("You have no note in progress.\n\r", ch);
	  return;
	}
      sprintf (buf, "%s: %s\n\rTo: %s\n\rLines: %d\n\r",
	       ch->ced->pnote->sender,
	       ch->ced->pnote->subject,
	       ch->ced->pnote->to_list,
	       ch->ced->pnote->lines
	);
      strcat (buf1, buf);
      strcat (buf1, ch->ced->pnote->text);

      page_to_char_limited (buf1, ch); 
      return;
    }
  if (!str_cmp (arg, "post") || !str_prefix (arg, "send"))
    {
      FILE *fp;
      char *strtime;
      
      check_ced (ch);
      
      if (ch->ced->pnote == NULL)
	{
	  send_to_char ("You have no note in progress.\n\r", ch);
	  return;
	}
      if (board_here == 1 && LEVEL (ch) < IMM_LEVEL)
	{
	  send_to_char ("This board is reserved for immortals posting messages to mortals.\n\r", ch);
	  send_to_char ("Please post on a public board if you wish to write a note.\n\r", ch);
	  return;
	}
      if (!str_cmp (ch->ced->pnote->to_list, ""))
	{
	  send_to_char (
	    "You need to provide a recipient (name, all, or immortal).\n\r",
			 ch);
	  return;
	}
      if (!str_cmp (ch->ced->pnote->subject, ""))
	{
	  send_to_char ("You need to provide a subject.\n\r", ch);
	  return;
	}
      if (IS_SET(ch->act, PLR_LAMER))
	{
	  send_to_char("You have lost your board writing privileges.\n\r", ch);
	  send_to_char("Maybe if you grow up you will be allowed to start\n\r", ch);
	  send_to_char("posting on the board again, however since you have\n\r", ch);
	  send_to_char("consistently shown yourself to be lame this is not likely.\n\r", ch);
	  return;
	}
      ch->pcdata->online_spot->notes_this_reboot++;
      if(ch->pcdata->online_spot->notes_this_reboot > 8)
	{
	  send_to_char("You have already written too many notes this reboot.\n\r", ch);
	  return;
	}

      ch->ced->pnote->next = NULL;
      strtime = ctime (&current_time);
      strtime[strlen (strtime) - 1] = '\0';
      ch->ced->pnote->board_num = board_here;
      ch->ced->pnote->date = str_dup (strtime);
      ch->ced->pnote->date_stamp = current_time;
      if (note_list == NULL)
	{
	  note_list = ch->ced->pnote;
	}
      else
	{
	  for (pnote = note_list; pnote->next != NULL; pnote = pnote->next)
	    ;
	  pnote->next = ch->ced->pnote;
	}
      pnote = ch->ced->pnote;
      ch->ced->pnote = NULL;
#ifndef WINDOWS
//      fclose (fpReserve);
#endif
      if ((fp = fopen (NOTE_FILE, "a")) == NULL)
	{
	  perror (NOTE_FILE);
	}
      else
	{
	  fprintf (fp, "Sender %s~\n", fix_string (pnote->sender));
	  fprintf (fp, "TBoard %d\n", pnote->board_num);
	  fprintf (fp, "Date %s~\n", pnote->date);
	  fprintf (fp, "Stamp %ld\n", pnote->date_stamp);
	  fprintf (fp, "To %s~\n", fix_string (pnote->to_list));
	  fprintf (fp, "Subject %s~\n", fix_string (pnote->subject));
	  fprintf (fp, "Text\n%s~\n", pnote->text);
	  fprintf (fp, "End\n\n");
	  fclose (fp);
	}
#ifndef WINDOWS
//      fpReserve = fopen (NULL_FILE, "r");
#endif
      send_to_char ("Ok.\n\r", ch);
      return;
    }
  if (!str_cmp (arg, "remove"))
    {
      if (!is_number (argy))
	{
	  send_to_char ("Note remove which number?\n\r", ch);
	  return;
	}
      anum = atoi (argy);
      vnum = 0;
      for (pnote = note_list; pnote != NULL; pnote = pnote->next)
	{
	  if (vnum++ == anum && (
				  (is_note_to (ch, pnote) && !is_name ("all", pnote->to_list)) || LEVEL (ch) > 109))
	    {
	      note_remove (ch, pnote);
	      send_to_char ("Ok.\n\r", ch);
	      return;
	    }
	}
      send_to_char ("No such note.\n\r", ch);
      return;
    }
  send_to_char ("Huh? Type 'help note' for usage.\n\r", ch);
  return;
}
Exemplo n.º 27
0
SPEC_RET spec_cast_undead( CHAR_DATA *ch )
{
	CHAR_DATA *victim;
	CHAR_DATA *v_next;
	char	  *spell;
	int		   sn;

	summon_if_hating( ch );

	if ( ch->position != POSITION_FIGHT
	  && ch->position != POSITION_EVASIVE
	  && ch->position != POSITION_DEFENSIVE
	  && ch->position != POSITION_AGGRESSIVE
	  && ch->position != POSITION_BERSERK )
	{
		return FALSE;
	}

	for ( victim = ch->in_room->first_person;  victim;  victim = v_next )
	{
		v_next = victim->next_in_room;

		if ( who_fighting(victim) != ch )	continue;
		if ( number_bits(2) == 0 )			continue;

		if ( IS_PG(victim) )
			break;
		if ( IS_MOB(victim) && HAS_BIT(victim->affected_by, AFFECT_CHARM) )
			break;
	}

	if ( !victim )		return FALSE;
	if ( victim == ch )	return FALSE;

	for ( ; ; )
	{
		int min_level;

		switch ( number_bits(4) )
		{
		  case  0:	min_level =  1;		spell = "chill touch";		break;
		  case  1:	min_level = 22;		spell = "weaken";			break;
		  case  2:	min_level = 24;		spell = "curse";			break;
		  case  3:	min_level = 26;		spell = "blindness";		break;
		  case  4:	min_level = 28;		spell = "poison";			break;
		  case  5:	min_level = 30;		spell = "energy drain";		break;
		  case  6:	min_level = 36;		spell = "harm";				break;
		  default:	min_level = 80;		spell = "gate";				break;
		}

		if ( get_level(ch) >= min_level )
			break;
	}

	sn = skill_lookup( spell );
	if ( sn < 0 )
		return FALSE;

	(*table_skill[sn]->spell_fun) ( sn, get_level(ch)/2, ch, victim );
	return TRUE;
}
Exemplo n.º 28
0
SPEC_RET spec_cast_mage( CHAR_DATA *ch )
{
	CHAR_DATA *victim;
	CHAR_DATA *v_next;
	char	  *spell;
	int		   sn;

	summon_if_hating( ch );

	if ( ch->position != POSITION_FIGHT
	  && ch->position != POSITION_EVASIVE
	  && ch->position != POSITION_DEFENSIVE
	  && ch->position != POSITION_AGGRESSIVE
	  && ch->position != POSITION_BERSERK )
	{
		return FALSE;
	}

	for ( victim = ch->in_room->first_person;  victim;  victim = v_next )
	{
		v_next = victim->next_in_room;

		if ( who_fighting(victim) != ch )	continue;
		if ( number_bits(2) )				continue;

		if ( IS_PG(victim) )
			break;
		if ( IS_MOB(victim) && HAS_BIT(victim->affected_by, AFFECT_CHARM) )
			break;
	}

	if ( !victim )		return FALSE;
	if ( victim == ch )	return FALSE;

	for ( ; ; )
	{
		int min_level;

		switch ( number_bits(4) )
		{
		  case  0:	min_level =  1;		spell = "magic missile";	break;
		  case  1:	min_level =  6;		spell = "chill touch";		break;
		  case  2:	min_level = 14;		spell = "weaken";			break;
		  case  3:	min_level = 16;		spell = "galvanic whip";	break;
		  case  4:	min_level = 22;		spell = "colour spray";		break;
		  case  5:	min_level = 24;		spell = "weaken";			break;
		  case  6:	min_level = 26;		spell = "energy drain";		break;
		  case  7:	min_level = 28;		spell = "spectral furor";	break;
		  case  8:
		  case  9:	min_level = 30;		spell = "fireball";			break;
		  default:	min_level = 40;		spell = "acid blast";		break;
		}

		if ( get_level(ch) >= min_level )
			break;
	}

	sn = skill_lookup( spell );
	if ( sn < 0 )
		return FALSE;

	(*table_skill[sn]->spell_fun) ( sn, get_level(ch)/2, ch, victim );
	return TRUE;
}
Exemplo n.º 29
0
SPEC_RET spec_cast_cleric( CHAR_DATA *ch )
{
	CHAR_DATA *victim;
	CHAR_DATA *v_next;
	char	  *spell;
	int		   sn;

	summon_if_hating( ch );

	if ( ch->position != POSITION_FIGHT
	  && ch->position != POSITION_EVASIVE
	  && ch->position != POSITION_DEFENSIVE
	  && ch->position != POSITION_AGGRESSIVE
	  && ch->position != POSITION_BERSERK )
	{
		return FALSE;
	}

	for ( victim = ch->in_room->first_person;  victim;  victim = v_next )
	{
		v_next = victim->next_in_room;

		if ( who_fighting(victim) != ch )	continue;
		if ( number_bits(2) )				continue;

		if ( IS_PG(victim) )
			break;
		if ( IS_MOB(victim) && HAS_BIT(victim->affected_by, AFFECT_CHARM) )
			break;
	}

	if ( !victim  )		return FALSE;
	if ( victim == ch )	return FALSE;

	for ( ; ; )
	{
		int min_level;

		/* (FF) (LV) questi min_level forse sono da tarare */
		switch ( number_bits(4) )
		{
		  case  0:	min_level =  1;		spell = "cause light";		break;
		  case  1:	min_level =  6;		spell = "cause serious";	break;
		  case  2:	min_level = 12;		spell = "earthquake";		break;
		  case  3:	min_level = 14;		spell = "blindness";		break;
		  case  4:	min_level = 18;		spell = "cause critical";	break;
		  case  5:	min_level = 20;		spell = "dispel evil";		break;
		  case  6:	min_level = 24;		spell = "curse";			break;
		  case  7:	min_level = 26;		spell = "flamestrike";		break;
		  case  8:
		  case  9:
		  case 10:	min_level = 30;		spell = "harm";				break;
		  default:	min_level = 32;		spell = "dispel magic";		break;
		}

		if ( get_level(ch) >= min_level )
			break;
	}

	sn = skill_lookup( spell );
	if ( sn < 0 )
		return FALSE;

	(*table_skill[sn]->spell_fun) ( sn, get_level(ch)/2, ch, victim );
	return TRUE;
}
Exemplo n.º 30
0
DO_RET do_oredit( CHAR_DATA *ch, char *argument )
{
	DESCRIPTOR_DATA	*d;
	ROOM_DATA		*room;
	char			arg[MIL];

	if ( IS_MOB(ch) || !ch->desc )
	{
		send_to_char( ch, "I don't think so...\r\n" );
		return;
	}

	argument = one_argument( argument, arg );

	if ( !VALID_STR(argument) )
		room = ch->in_room;
	else
	{
		if ( is_number(arg) )
		{
			argument = one_argument( argument, arg );
			room = get_room_index( NULL, atoi(arg) );
		}
		else
		{
			send_to_char( ch, "Vnum must be specified in numbers!\r\n" );
			return;
		}
	}

	if ( !room )
	{
		send_to_char( ch, "That room does not exist!\r\n" );
		return;
	}

	/* Make sure the room isnt already being edited */
	for ( d = first_descriptor; d; d = d->next )
	{
		if ( d->connected == CON_REDIT )
		{
			if ( d->olc && OLC_VNUM(d) == room->vnum )
			{
				ch_printf( ch, "That room is currently being edited by %s.\r\n", d->character->name );
				return;
			}
		}
	}

	if ( !can_modify_room(ch, room) )
		return;

	d = ch->desc;
	CREATE( d->olc, OLC_DATA, 1 );
	OLC_VNUM(d)	= room->vnum;
	OLC_CHANGE(d) = FALSE;
	d->character->dest_buf = room;
	d->connected = CON_REDIT;
	redit_disp_menu( d );

	act( AT_ACTION, "$n starts using OLC.", ch, NULL, NULL, TO_ADMIN );
}