From: Volar25@aol.com <Volar25@aol.com>
To: rom@rom.org <rom@rom.org>
Subject: [SNIPPET]weave skill
Date: Saturday, March 04, 2000 12:54 AM

Hi,

This is a skill called weave, characters with this skill are able to weave 
basket containers(heh basket weaving...anyone wanna add some underwater stuff 
to this? *snicker* ) , The higher the level, the better the basket they are 
able to create. Also, the ultimate part to this skill, weave rift, players 
are able to weave warp, and go through a rift to a target....let me know 
whatcha think..


Volar
Chronicles of Chaos
http://coc.mudservices.com
telnet://coc.mudservices.com 6666


/* add this function: */
void do_weave( CHAR_DATA *ch, char *argument )
{
    OBJ_DATA *basket, *fabric;
    char arg1[MAX_INPUT_LENGTH];
    char arg2[MAX_INPUT_LENGTH];
    int chance = 0;
    int move = 0, movetemp = 0;

        argument = one_argument( argument, arg1 );
        argument = one_argument( argument, arg2 );

        if ((chance = get_skill(ch,gsn_weave)) == 0)
    {
        send_to_char( "You wouldn't know where to begin\n\r", ch );
        return;
    }

        if ( arg1[0] == '\0')
        {
        send_to_char("What do you wish to weave?\n\r",ch);
    send_to_char("Availible options: basket rift\n\r", ch);
        return;
    }

    if(ch->mana < 70)
    {
    send_to_char("You are unable to perform the proper weave.\n\r", ch);
    return;
    }

    if ( !is_name( arg1,"basket rift" ) )
        {
                send_to_char("You lack the knowledge.\n\r",ch);
                return;
        }

    if (!str_cmp(arg1,"basket"))
    {
    if ( !is_name( arg2,"small medium large magical" ) )
    {
    if(ch->level > 3 && ch->level < 20
           && (get_skill(ch,gsn_weave) > 10 ) )
    {
        send_to_char("availible types: small\n\r",ch);
        return;
    }
    }

    if ( !is_name( arg2,"small medium large magical" ) )
    {
        if(ch->level >= 20 && ch->level < 40
           && (get_skill(ch,gsn_weave) > 30 ) )
    {
        send_to_char("availible types: small medium\n\r",ch);
        return;
    }
    }

   if ( !is_name( arg2,"small medium large magical" ) )
    {
        if(ch->level >= 40 && ch->level < 60
           && (get_skill(ch,gsn_weave) > 50 )  )
    {
        send_to_char("availible types: small medium large\n\r",ch);
        return;
    }
    }

   if ( !is_name( arg2,"small medium large magical" ) )
    {
        if(ch->level >= 60
           && (get_skill(ch,gsn_weave) > 70 ) )
    {
        send_to_char("availible types: small medium large magical\n\r",ch);
        return;
    }
    }

    fabric  = get_eq_char(ch,WEAR_HOLD);


        if ( (fabric == NULL) || (str_cmp(fabric->name,"straw") ) )
       {
        send_to_char("You lack the proper material.\n\r",ch);
        return;
        }

        if ( number_percent( ) < chance / 3 )
        {
          act( "$n attempts to weave a complex-looking basket.", ch, NULL, 
NULL, TO_ROOM );
      act( "You attempt to make your masterpiece.",ch,NULL, NULL, TO_CHAR);
      act( "You chuckle silently as you see $m totally ruin it.", ch, NULL, 
NULL, TO_ROOM );
      act( "You fail miserably.", ch,NULL, NULL, TO_CHAR );
      extract_obj (fabric);
          return;
        }

        extract_obj (fabric);

      if ( !str_cmp(arg2,"small" ) )
      {
        basket = create_object( get_obj_index( OBJ_VNUM_BASKET_STRAW_SMALL ), 
0 );
        basket->level = ch->level;
            obj_to_char( basket, ch );
        }
        else if (!str_cmp(arg2,"medium"))
        {
       basket = create_object( get_obj_index( OBJ_VNUM_BASKET_STRAW_MEDIUM ), 
0 );
       basket->level = ch->level;
           obj_to_char( basket, ch );
        }
        else if (!str_cmp(arg2,"large"))
        {
       basket = create_object( get_obj_index( OBJ_VNUM_BASKET_STRAW_LARGE ), 
0 );
       basket->level = ch->level;
           obj_to_char( basket, ch );
        }
        else if (!str_cmp(arg2,"magical"))
        {
      basket = create_object( get_obj_index( OBJ_VNUM_BASKET_STRAW_MAGICAL ), 
0 );
          basket->level = ch->level;
      if(number_percent() < 10)
      {
         send_to_char("Your talent has produced the finest of products!\n\r", 
ch);
         basket->cost = 20000;
         SET_BIT(basket->extra_flags,ITEM_TATTOO);
         ch->perm_stat[STAT_INT] -= 1;
         send_to_char("This creation has drained your mind, you lose one 
point of intelligence.\n\r", ch);
          }
      obj_to_char( basket, ch );
        }
    else
        {
                send_to_char("You are unable to weave that.\n\r",ch);
                return;
        }

    act( "$n starts to weave a basket in an intricate pattern.", ch, NULL, 
NULL, TO_ROOM );
    act( "You attempt to weave your masterpiece.", ch,NULL, NULL, TO_CHAR );
    act( "$n weaving begins to take shape.", ch, NULL, NULL, TO_ROOM );
    act( "Your weavings are takeing shape!", ch,NULL, NULL, TO_CHAR ); 
    act( "$n wipes $s brow and shows $p to the room.", ch, basket, NULL, 
TO_ROOM );
    act( "You wipe your brow and show $p to the room.", ch, basket, NULL, 
TO_CHAR );
    }

    if (!str_cmp(arg1, "rift") )
    {

    CHAR_DATA *victim;
         bool gate_pet;

     if(ch->level < 60
           && (get_skill(ch,gsn_weave) < 65 ) )
        {
        send_to_char("You are not experienced enough.\n\r",ch);
        return;
        }

       if ( ( victim = get_char_world( ch, arg2 ) ) == NULL)
        {
           send_to_char( "They are no where to be found!\n\r", ch );
           return;
        }

        if ( ch == victim )
        {
           send_to_char( "Why would you want to rift to yourself?!\n\r", ch );
       return;
        }

        if (IS_IMMORTAL(victim))
        {
        send_to_char( "Rift to an immortal?!?! Are you Mad?\n\r", ch );
        return;
        }

      if (victim->in_room == NULL
    ||   !can_see_room(ch,victim->in_room)
    ||   IS_SET(victim->in_room->room_flags, ROOM_PRIVATE)
    ||   IS_SET(victim->in_room->room_flags, ROOM_SOLITARY)
    ||   IS_SET(victim->in_room->room_flags, ROOM_SAFE)
    ||   ch->level < (victim->level -2)
    ||   (!IS_NPC(victim) && victim->level >= LEVEL_HERO)  /* NOT trust */
    ||   (IS_NPC(victim) && saves_spell( ch->level, victim,DAM_OTHER))
    ||   is_in_war(ch)
    ||   is_in_war(victim)
    ||   IS_SET(victim->act,PLR_NOSUMMON))
    {
    send_to_char( "You failed.\n\r", ch );
        return;
    }

    movetemp = 200 - ch->level;
    move = ch->move - movetemp;
    if(move < movetemp)
    {
    send_to_char("You are too tired.\n\r", ch);
    return;
    }else{
    ch->move = move;
    }

    if (ch->pet != NULL && ch->in_room == ch->pet->in_room)
        gate_pet = TRUE;
    else
        gate_pet = FALSE;

    act("$n starts to weave complex traces with $s hand. All of a suddent a 
large rift appears before $m, and $n steps through.",ch,NULL,NULL,TO_ROOM );
    send_to_char("A large rift appears before you, and you step through 
it.\n\r", ch);
    char_from_room(ch);
    char_to_room(ch,victim->in_room);

    act("$n steps through a rift, and grins evily.",ch,NULL,NULL,TO_ROOM );
    do_look(ch,"auto");

    if (gate_pet)
    {
        act("$n steps through the rift.",ch->pet,NULL,NULL,TO_ROOM);
        send_to_char("You step through a rift in the sky.\n\r", ch);
        char_from_room(ch->pet);
        char_to_room(ch->pet,victim->in_room);
        act("$n has arrived through a rift int the 
sky.",ch->pet,NULL,NULL,TO_ROOM);
        do_look(ch->pet,"auto");
    }
}
        check_improve(ch,gsn_weave,FALSE,1);
    WAIT_STATE( ch, skill_table[gsn_weave].beats );
        return;
}

/* And of course you'll need to add normal stuff when adding a new 
skill..i'll leave that to you..getting tired. */


-- 
The latest released ROM source is at http://www.hypercube.org/tess/rom/.
