/*Dye clothing skill by Tamarae -(tamarae@zdnetonebox.com) written for The Kravothian Mysts *This Dyeing skill will allow a tailor to change the color of a piece of handmade clothing by *using a dye. Nice touch for RP muds. Part of the Tailoring group by Tamarae */ /*Dye clothing skill by Tamarae -(tamarae@zdnetonebox.com) *Syntax: dye */ /* Ported dye to smaug1.4a 12-22-01 Vladaar */ You will need to add item_dye for this skill. void do_dye( CHAR_DATA *ch, char *argument ) { char arg1[MAX_INPUT_LENGTH]; char arg2[MAX_INPUT_LENGTH]; char buf[MAX_INPUT_LENGTH]; OBJ_DATA *clothing, *dye; int chance; chance = (LEARNED(ch,gsn_dye)); /* Do we have the skill? */ if ( !IS_NPC(ch) && !(LEARNED(ch,gsn_dye))) { send_to_char( "You don't know how to do that!.\n\r", ch ); return; } /* Do we have the components? */ argument = one_argument( argument, arg1 ); if ( arg1[0] == '\0' ) { send_to_char( "Dye what?\n\r", ch ); send_to_char("Syntax: Dye (object) \n\r", ch); send_to_char("Available colors are: &rRed &BBlue &pPurple &YYellow &WWhite &bDblue &GGreen &CCyan &OBrown &gDgreen &cDcyan.\$ return; } if ( ( clothing = get_obj_carry( ch, arg1 ) ) == NULL ) { send_to_char( "You do not have anything to dye.\n\r", ch ); return; } argument = one_argument( argument, arg2 ); if ( arg2[0] == '\0' ) { send_to_char( "Which color?\n\r", ch ); send_to_char("Available colors are: &rRed &BBlue &pPurple &YYellow &WWhite &bDblue &GGreen &CCyan &OBrown &gDgreen &cDcyan.\$ return; } dye = get_eq_char(ch,WEAR_HOLD); if (dye == NULL || dye->item_type != ITEM_DYE) { send_to_char("You need a set of dyes.\n\r",ch); return; } if (clothing->pIndexData->vnum != 93) { send_to_char("Sorry, you many only dye handmade clothing types.\n\r", ch); return; } /* dye the clothing - success! */ if (number_percent() < chance) { if (!str_cmp(arg2,"red")) { sprintf( buf, "&r%s&w", clothing->short_descr ); STRFREE( clothing->short_descr ); clothing->short_descr = STRALLOC( buf ); } else if (!str_cmp(arg2,"blue")) { sprintf( buf, "&B%s&w", clothing->short_descr ); STRFREE( clothing->short_descr ); clothing->short_descr = STRALLOC( buf ); } else if (!str_cmp(arg2,"purple")) { sprintf( buf, "&p%s&w", clothing->short_descr ); STRFREE( clothing->short_descr ); clothing->short_descr = STRALLOC( buf ); } else if (!str_cmp(arg2,"yellow")) { sprintf( buf, "&Y%s&w", clothing->short_descr ); STRFREE( clothing->short_descr ); clothing->short_descr = STRALLOC( buf ); } else if (!str_cmp(arg2,"white")) { sprintf( buf, "&W%s&w", clothing->short_descr ); STRFREE( clothing->short_descr ); clothing->short_descr = STRALLOC( buf ); } else if (!str_cmp(arg2,"dblue")) { sprintf( buf, "&b%s&w", clothing->short_descr ); STRFREE( clothing->short_descr ); clothing->short_descr = STRALLOC( buf ); } else if (!str_cmp(arg2,"green")) { sprintf( buf, "&g%s&w", clothing->short_descr ); STRFREE( clothing->short_descr ); clothing->short_descr = STRALLOC( buf ); } else if (!str_cmp(arg2,"cyan")) { sprintf( buf, "&C%s&w", clothing->short_descr ); STRFREE( clothing->short_descr ); clothing->short_descr = STRALLOC( buf ); } else if (!str_cmp(arg2,"dgreen")) { sprintf( buf, "&G%s&w", clothing->short_descr ); STRFREE( clothing->short_descr ); clothing->short_descr = STRALLOC( buf ); } else if (!str_cmp(arg2,"dcyan")) { sprintf( buf, "&c%s", clothing->short_descr ); STRFREE( clothing->short_descr ); clothing->short_descr = STRALLOC( buf ); } else if (!str_cmp(arg2,"brown")) { sprintf( buf, "&O%s&w", clothing->short_descr ); STRFREE( clothing->short_descr ); clothing->short_descr = STRALLOC( buf ); } else { send_to_char("Available colors are: &rRed &BBlue &pPurple &YYellow &WWhite &bDBlue &GGreen &CCyan &OBrown &gDgreen &cDcyan &$ return; } extract_obj( dye ); send_to_char("You dye the material elegantly.\n\r", ch); act( AT_IMMORT, "$n dyes the material elegantly.", ch, NULL, NULL, TO_ROOM ); learn_from_success(ch, gsn_dye); } else /* failure of skill */ { extract_obj( dye ); send_to_char("You fail to dye the clothing properly.\n\r", ch); act( AT_IMMORT, "$n fails to dye the clothing properly.", ch, NULL, NULL, TO_ROOM ); learn_from_failure(ch, gsn_dye); } }