//
// C Implementation: fishing
//
// Description:
//
//
// Author: robert <robert@localhost>, (C) 2005
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "mud.h"
/* Fish Defines */
#define OBJ_VNUM_CRESS_FISH 150
#define OBJ_VNUM_SPUTTER_FISH 151
#define OBJ_VNUM_DARG_FISH 152
#define OBJ_VNUM_EMERALD_FISH 153
#define OBJ_VNUM_ELL_FISH 154
#define OBJ_VNUM_BOG_WORM 155
#define OBJ_VNUM_ROSE_MAGGOT 156
/*
void do_bait( CHAR_DATA * ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
OBJ_DATA *obj_pole;
OBJ_DATA *bait;
if( arg[0] == '\0' )
{
if( ( bait = get_objtype_carry( ch, ITEM_FISHING_BAIT ) ) == NULL )
{
send_to_char( "You are not carrying any bait.\n\r", ch );
return;
}
}
else
{
if( ( bait = get_obj_carry( ch, arg ) ) == NULL )
{
send_to_char( "You are not carrying that bait.\n\r", ch );
return;
}
}
if( ( obj_pole = get_eq_char( ch, WEAR_HOLD ) ) == NULL || obj_pole->item_type != ITEM_FISHING_POLE )
{
send_to_char( "You need to be holding your fishing pole if you want to bait it.\n\r", ch );
return;
}
if( obj_pole->value[0] > 0 )
{
send_to_char( "You already baited your hook.\n\r", ch );
return;
}
obj_pole->value[0] = 1;
act( AT_MAGIC, "$n places bait on $s fishing pole.", ch, NULL, NULL, TO_ROOM );
act( AT_MAGIC, "You place bait on your fishing pole.", ch, NULL, NULL, TO_CHAR );
separate_obj( bait );
if( bait->serial == cur_obj )
global_objcode = rOBJ_USED;
extract_obj( bait );
return;
return;
}*/
void do_cast_line( CHAR_DATA * ch, char *argument )
{
return;
}
void do_wind_line( CHAR_DATA * ch, char *argument )
{
return;
}
void do_cast_net( CHAR_DATA * ch, char *argument )
{
return;
}
void do_haul_net( CHAR_DATA * ch, char *argument )
{
return;
}
void do_gut_fish( CHAR_DATA * ch, char *argument )
{
return;
}
void do_smoke_fish( CHAR_DATA * ch, char *argument )
{
return;
}
void do_dry_fish( CHAR_DATA * ch, char *argument )
{
return;
}
/* fishing aug 2005 intalled by tommi code by qidixan
void do_fish( CHAR_DATA *ch, char *argument )
{
OBJ_DATA *obj_pole;
if( IS_NPC( ch ) && IS_AFFECTED( ch, AFF_CHARM ) )
{
send_to_char( "You can't do that right now.\n\r", ch );
return;
}
if( !IS_NPC( ch ) && ch->level < skill_table[gsn_fish]->skill_level[ch->class] )
{
send_to_char( "You don't know how to fish.\n\r", ch );
return;
}
if( ch->fighting )
{
send_to_char( "Wait until you are finished fighting.\n\r", ch );
return;
}
if( ( obj_pole = get_eq_char( ch, WEAR_HOLD ) ) == NULL
|| obj_pole->item_type != ITEM_FISHING_POLE )
{
send_to_char( "You need a pole for that!\n\r", ch );
return;
}
if( obj_pole->value[0] < 1 ) //check for baited - item value set
{
send_to_char( "You need to bait your pole first.\n\r", ch );
return;
}
if( !ch->in_room )
{
send_to_char( "You are floating in space.\n\r", ch );
return;
}
switch( ch->in_room->sector_type )
{
//Valid cases - in water but not underwater.
case SECT_WATER_SWIM:
case SECT_WATER_NOSWIM:
//boat/flight check...
if( !IS_AFFECTED( ch, AFF_FLYING ) && !IS_AFFECTED( ch, AFF_FLOATING) )
{
OBJ_DATA *obj;
for( obj = ch->first_carrying; obj; obj = obj->next_content )
if( obj->item_type == ITEM_BOAT )
break;
if( !obj )
{
send_to_char( "You can't fish while you are surrounded by water.\n\r", ch );
return;
}
}
break;
//Invalid cases
case SECT_UNDERWATER:
case SECT_OCEANFLOOR:
send_to_char( "You cannot fish while underwater!\n\r", ch );
return;
default:
send_to_char( "You need to be near water for that!\n\r", ch );
return;
}
//Ok, everything is in order - fishing . . .
if( number_percent() < LEARNED( ch, gsn_fish ) )
{
//success
int caught = number_percent() + obj_pole->value[1];
int skill = 2 * number_percent() + LEARNED( ch, gsn_fish );
OBJ_DATA *fish_caught;
obj_pole->value[0] = 0; //remove bait
obj_pole->value[1] = 0; //remove bait_type
act( AT_MAGIC, "$n has a successful time fishing.", ch, NULL, NULL, TO_ROOM );
if( caught < 51 ) //50%
{
//load common
fish_caught = create_object( get_obj_index( OBJ_VNUM_CRESS_FISH ), 0 );
//Determine how many are caught.
skill /= 45;
skill = (skill>0?skill:1);
fish_caught->count = skill;
fish_caught->pIndexData->count += (skill - 1);
numobjsloaded += (skill - 1);
act( AT_MAGIC, "You catch some cress fish.", ch, NULL, NULL, TO_CHAR );
}
else if( caught < 76 ) //25%
{
//load less common
fish_caught = create_object( get_obj_index(OBJ_VNUM_SPUTTER_FISH), 0 );
//Determine how many are caught.
skill /= 55;
skill = (skill>0?skill:1);
fish_caught->count = skill;
fish_caught->pIndexData->count += (skill - 1);
numobjsloaded += (skill - 1);
act( AT_MAGIC, "You catch some sputter fish.", ch, NULL, NULL, TO_CHAR );
}
else if( caught < 91 ) //15%
{
//load uncommon
fish_caught = create_object( get_obj_index( OBJ_VNUM_DARG_FISH ), 0 );
//Determine how many are caught.
skill /= 65;
skill = (skill>0?skill:1);
fish_caught->count = skill;
fish_caught->pIndexData->count += (skill - 1);
numobjsloaded += (skill - 1);
act( AT_MAGIC, "You catch some darg fish.", ch, NULL, NULL, TO_CHAR );
}
else if( caught < 98 ) //7%
{
//load rare
fish_caught = create_object( get_obj_index( OBJ_VNUM_EMERALD_FISH ), 0 );
//Determine how many are caught.
skill /= 75;
skill = (skill>0?skill:1);
fish_caught->count = skill;
fish_caught->pIndexData->count += (skill - 1);
numobjsloaded += (skill - 1);
act( AT_MAGIC, "You catch some emerald fish.", ch, NULL, NULL, TO_CHAR );
}
else //3%
{
//load ultra rare
fish_caught = create_object( get_obj_index( OBJ_VNUM_ELL_FISH ), 0 );
//Determine how many are caught.
skill /= 85;
skill = (skill>0?skill:1);
fish_caught->count = skill;
fish_caught->pIndexData->count += (skill - 1);
numobjsloaded += (skill - 1);
act( AT_MAGIC, "You catch some ellusive ell fish.", ch, NULL, NULL, TO_CHAR );
}
//Don't let us crash if the fish don't exist.
if( !fish_caught )
{
log_string( " Error: Fish not created.\n\r" );
send_to_char( "A divine mistake robs you of your catch.\n\r", ch );
}
else
obj_to_char( fish_caught, ch );
learn_from_success( ch, gsn_fish );
}
else
{
//fail
obj_pole->value[0] = 0; //remove bait
obj_pole->value[1] = 0; //remove bait_type
act( AT_MAGIC, "$n attempts to catch a fish but winds up with an empty hook.", ch, NULL, NULL, TO_ROOM );
act( AT_MAGIC, "You fail to catch anything.", ch, NULL, NULL, TO_CHAR );
learn_from_failure( ch, gsn_fish );
}
}
void do_bait( CHAR_DATA * ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
OBJ_DATA *obj_pole;
OBJ_DATA *bait;
argument = one_argument( argument, arg );
if( ms_find_obj( ch ) )
return;
if( arg[0] == '\0' )
{
if( ( bait = get_objtype_carry( ch, ITEM_BAIT ) ) == NULL )
{
send_to_char( "You are not carrying any bait.\n\r", ch );
return;
}
}
else
{
if( ( bait = get_obj_objtype_carry( ch, arg, ITEM_BAIT ) ) == NULL )
{
send_to_char( "You are not carrying that bait.\n\r", ch );
return;
}
}
if( ( obj_pole = get_eq_char( ch, WEAR_HOLD ) ) == NULL
|| obj_pole->item_type != ITEM_FISHING_POLE )
{
send_to_char( "You need to be holding your fishing pole if you want to bait it.\n\r", ch );
return;
}
if( obj_pole->value[0] > 0 )
{
send_to_char( "You already baited your hook.\n\r", ch );
return;
}
obj_pole->value[0] = 1;
switch( bait->pIndexData->vnum )
{
case OBJ_VNUM_ROSE_MAGGOT:
obj_pole->value[1] = 2;
break;
case OBJ_VNUM_BOG_WORM:
default:
obj_pole->value[1] = 0;
break;
}
act( AT_MAGIC, "$n places bait on $s fishing pole.", ch, NULL, NULL, TO_ROOM );
act( AT_MAGIC, "You place bait on your fishing pole.", ch, NULL, NULL, TO_CHAR );
separate_obj( bait );
if( bait->serial == cur_obj )
global_objcode = rOBJ_USED;
extract_obj( bait );
return;
} */