vector<string> SLFKCondNode::has_semantic_fk() const { vector<string> ret; ret.push_back(get_etype()); ret.push_back(get_atype()); return ret; }
void do_mposet( CHAR_DATA * ch, const char *argument ) { char arg1[MAX_INPUT_LENGTH]; char arg2[MAX_INPUT_LENGTH]; char arg3[MAX_INPUT_LENGTH]; char buf[MAX_STRING_LENGTH]; OBJ_DATA *obj; char outbuf[MAX_STRING_LENGTH]; int value, tmp; /* * A desc means switched.. too many loopholes if we allow that.. */ if ( !IS_NPC( ch ) || IS_AFFECTED( ch, AFF_CHARM ) || ch->desc ) { send_to_char( "Huh?\r\n", ch ); return; } smash_tilde( argument ); argument = one_argument( argument, arg1 ); argument = one_argument( argument, arg2 ); mudstrlcpy( arg3, argument, MAX_INPUT_LENGTH ); if ( !*arg1 ) { progbug( "MpOset: no args", ch ); return; } if ( ( obj = get_obj_here( ch, arg1 ) ) == NULL ) { progbug( "MpOset: no object", ch ); return; } if ( IS_OBJ_STAT( obj, ITEM_PROTOTYPE ) ) { progbug( "MpOset: can't set prototype items", ch ); return; } separate_obj( obj ); value = atoi( arg3 ); if ( !str_cmp( arg2, "value0" ) || !str_cmp( arg2, "v0" ) ) { obj->value[0] = value; return; } if ( !str_cmp( arg2, "value1" ) || !str_cmp( arg2, "v1" ) ) { obj->value[1] = value; return; } if ( !str_cmp( arg2, "value2" ) || !str_cmp( arg2, "v2" ) ) { obj->value[2] = value; return; } if ( !str_cmp( arg2, "value3" ) || !str_cmp( arg2, "v3" ) ) { obj->value[3] = value; return; } if ( !str_cmp( arg2, "value4" ) || !str_cmp( arg2, "v4" ) ) { obj->value[4] = value; return; } if ( !str_cmp( arg2, "value5" ) || !str_cmp( arg2, "v5" ) ) { obj->value[5] = value; return; } if ( !str_cmp( arg2, "type" ) ) { if ( !argument || argument[0] == '\0' ) { progbug( "MpOset: no type", ch ); return; } value = get_otype( argument ); if ( value < 1 ) { progbug( "MpOset: Invalid type", ch ); return; } obj->item_type = ( short ) value; return; } if ( !str_cmp( arg2, "flags" ) ) { if ( !argument || argument[0] == '\0' ) { progbug( "MpOset: no flags", ch ); return; } while ( argument[0] != '\0' ) { argument = one_argument( argument, arg3 ); value = get_oflag( arg3 ); if ( value < 0 || value >= MAX_BITS ) progbug( "MpOset: Invalid flag", ch ); else { if ( value == ITEM_PROTOTYPE ) progbug( "MpOset: can't set prototype flag", ch ); else xTOGGLE_BIT( obj->extra_flags, value ); } } return; } if ( !str_cmp( arg2, "wear" ) ) { if ( !argument || argument[0] == '\0' ) { progbug( "MpOset: no wear", ch ); return; } while ( argument[0] != '\0' ) { argument = one_argument( argument, arg3 ); value = get_wflag( arg3 ); if ( value < 0 || value > 31 ) progbug( "MpOset: Invalid wear", ch ); else TOGGLE_BIT( obj->wear_flags, 1 << value ); } return; } if ( !str_cmp( arg2, "level" ) ) { obj->level = value; return; } if ( !str_cmp( arg2, "weight" ) ) { obj->weight = value; return; } if ( !str_cmp( arg2, "cost" ) ) { obj->cost = value; return; } if ( !str_cmp( arg2, "timer" ) ) { obj->timer = value; return; } if ( !str_cmp( arg2, "name" ) ) { STRFREE( obj->name ); obj->name = STRALLOC( arg3 ); return; } if ( !str_cmp( arg2, "short" ) ) { STRFREE( obj->short_descr ); obj->short_descr = STRALLOC( arg3 ); if ( obj == supermob_obj ) { STRFREE( supermob->short_descr ); supermob->short_descr = QUICKLINK( obj->short_descr ); } /* * Feature added by Narn, Apr/96 * * If the item is not proto, add the word 'rename' to the keywords * * if it is not already there. */ if ( str_infix( "mprename", obj->name ) ) { snprintf( buf, MAX_STRING_LENGTH, "%s %s", obj->name, "mprename" ); STRFREE( obj->name ); obj->name = STRALLOC( buf ); } return; } if ( !str_cmp( arg2, "long" ) ) { STRFREE( obj->description ); mudstrlcpy( buf, arg3, MAX_STRING_LENGTH ); obj->description = STRALLOC( buf ); return; } if ( !str_cmp( arg2, "actiondesc" ) ) { if ( strstr( arg3, "%n" ) || strstr( arg3, "%d" ) || strstr( arg3, "%l" ) ) { progbug( "MpOset: Illegal actiondesc", ch ); return; } STRFREE( obj->action_desc ); obj->action_desc = STRALLOC( arg3 ); return; } if ( !str_cmp( arg2, "affect" ) ) { AFFECT_DATA *paf; short loc; int bitv; argument = one_argument( argument, arg2 ); if ( arg2[0] == '\0' || !argument || argument[0] == 0 ) { progbug( "MpOset: Bad affect syntax", ch ); send_to_char( "Usage: oset <object> affect <field> <value>\r\n", ch ); return; } loc = get_atype( arg2 ); if ( loc < 1 ) { progbug( "MpOset: Invalid affect field", ch ); return; } if ( loc >= APPLY_AFFECT && loc < APPLY_WEAPONSPELL ) { bitv = 0; while ( argument[0] != '\0' ) { argument = one_argument( argument, arg3 ); if ( loc == APPLY_AFFECT ) value = get_aflag( arg3 ); else value = get_risflag( arg3 ); if ( value < 0 || value > 31 ) progbug( "MpOset: bad affect flag", ch ); else SET_BIT( bitv, 1 << value ); } if ( !bitv ) return; value = bitv; } else { argument = one_argument( argument, arg3 ); value = atoi( arg3 ); } CREATE( paf, AFFECT_DATA, 1 ); paf->type = -1; paf->duration = -1; paf->location = loc; paf->modifier = value; xCLEAR_BITS( paf->bitvector ); paf->next = NULL; LINK( paf, obj->first_affect, obj->last_affect, next, prev ); ++top_affect; return; } if ( !str_cmp( arg2, "rmaffect" ) ) { AFFECT_DATA *paf; short loc, count; if ( !argument || argument[0] == '\0' ) { progbug( "MpOset: no rmaffect", ch ); return; } loc = atoi( argument ); if ( loc < 1 ) { progbug( "MpOset: Invalid rmaffect", ch ); return; } count = 0; for ( paf = obj->first_affect; paf; paf = paf->next ) { if ( ++count == loc ) { UNLINK( paf, obj->first_affect, obj->last_affect, next, prev ); DISPOSE( paf ); send_to_char( "Removed.\r\n", ch ); --top_affect; return; } } progbug( "MpOset: rmaffect not found", ch ); return; } /* * save some finger-leather */ if ( !str_cmp( arg2, "ris" ) ) { snprintf( outbuf, MAX_STRING_LENGTH, "%s affect resistant %s", arg1, arg3 ); do_mposet( ch, outbuf ); snprintf( outbuf, MAX_STRING_LENGTH, "%s affect immune %s", arg1, arg3 ); do_mposet( ch, outbuf ); snprintf( outbuf, MAX_STRING_LENGTH, "%s affect susceptible %s", arg1, arg3 ); do_mposet( ch, outbuf ); return; } if ( !str_cmp( arg2, "r" ) ) { snprintf( outbuf, MAX_STRING_LENGTH, "%s affect resistant %s", arg1, arg3 ); do_mposet( ch, outbuf ); return; } if ( !str_cmp( arg2, "i" ) ) { snprintf( outbuf, MAX_STRING_LENGTH, "%s affect immune %s", arg1, arg3 ); do_mposet( ch, outbuf ); return; } if ( !str_cmp( arg2, "s" ) ) { snprintf( outbuf, MAX_STRING_LENGTH, "%s affect susceptible %s", arg1, arg3 ); do_mposet( ch, outbuf ); return; } if ( !str_cmp( arg2, "ri" ) ) { snprintf( outbuf, MAX_STRING_LENGTH, "%s affect resistant %s", arg1, arg3 ); do_mposet( ch, outbuf ); snprintf( outbuf, MAX_STRING_LENGTH, "%s affect immune %s", arg1, arg3 ); do_mposet( ch, outbuf ); return; } if ( !str_cmp( arg2, "rs" ) ) { snprintf( outbuf, MAX_STRING_LENGTH, "%s affect resistant %s", arg1, arg3 ); do_mposet( ch, outbuf ); snprintf( outbuf, MAX_STRING_LENGTH, "%s affect susceptible %s", arg1, arg3 ); do_mposet( ch, outbuf ); return; } if ( !str_cmp( arg2, "is" ) ) { snprintf( outbuf, MAX_STRING_LENGTH, "%s affect immune %s", arg1, arg3 ); do_mposet( ch, outbuf ); snprintf( outbuf, MAX_STRING_LENGTH, "%s affect susceptible %s", arg1, arg3 ); do_mposet( ch, outbuf ); return; } /* * Make it easier to set special object values by name than number * -Thoric */ tmp = -1; switch ( obj->item_type ) { case ITEM_WEAPON: if ( !str_cmp( arg2, "weapontype" ) ) { unsigned int x; value = -1; for ( x = 0; x < sizeof( attack_table ) / sizeof( attack_table[0] ); x++ ) if ( !str_cmp( arg3, attack_table[x] ) ) value = x; if ( value < 0 ) { progbug( "MpOset: Invalid weapon type", ch ); return; } tmp = 3; break; } if ( !str_cmp( arg2, "condition" ) ) tmp = 0; break; case ITEM_ARMOR: if ( !str_cmp( arg2, "condition" ) ) tmp = 3; if ( !str_cmp( arg2, "ac" ) ) tmp = 1; break; case ITEM_SALVE: if ( !str_cmp( arg2, "slevel" ) ) tmp = 0; if ( !str_cmp( arg2, "maxdoses" ) ) tmp = 1; if ( !str_cmp( arg2, "doses" ) ) tmp = 2; if ( !str_cmp( arg2, "delay" ) ) tmp = 3; if ( !str_cmp( arg2, "spell1" ) ) tmp = 4; if ( !str_cmp( arg2, "spell2" ) ) tmp = 5; if ( tmp >= 4 && tmp <= 5 ) value = skill_lookup( arg3 ); break; case ITEM_SCROLL: case ITEM_POTION: case ITEM_PILL: if ( !str_cmp( arg2, "slevel" ) ) tmp = 0; if ( !str_cmp( arg2, "spell1" ) ) tmp = 1; if ( !str_cmp( arg2, "spell2" ) ) tmp = 2; if ( !str_cmp( arg2, "spell3" ) ) tmp = 3; if ( tmp >= 1 && tmp <= 3 ) value = skill_lookup( arg3 ); break; case ITEM_STAFF: case ITEM_WAND: if ( !str_cmp( arg2, "slevel" ) ) tmp = 0; if ( !str_cmp( arg2, "spell" ) ) { tmp = 3; value = skill_lookup( arg3 ); } if ( !str_cmp( arg2, "maxcharges" ) ) tmp = 1; if ( !str_cmp( arg2, "charges" ) ) tmp = 2; break; case ITEM_CONTAINER: if ( !str_cmp( arg2, "capacity" ) ) tmp = 0; if ( !str_cmp( arg2, "cflags" ) ) tmp = 1; if ( !str_cmp( arg2, "key" ) ) tmp = 2; break; case ITEM_SWITCH: case ITEM_LEVER: case ITEM_PULLCHAIN: case ITEM_BUTTON: if ( !str_cmp( arg2, "tflags" ) ) { tmp = 0; value = get_trigflag( arg3 ); } break; } if ( tmp >= 0 && tmp <= 3 ) { obj->value[tmp] = value; return; } progbug( "MpOset: Invalid field", ch ); return; }
/* Edit class information -Thoric */ void do_setclass( CHAR_DATA *ch, char *argument ) { char arg1[MIL]; char arg2[MIL]; struct class_type *Class; int cl, value, i; set_char_color( AT_PLAIN, ch ); smash_tilde( argument ); argument = one_argument( argument, arg1 ); argument = one_argument( argument, arg2 ); if ( !VLD_STR( arg1 ) ) { send_to_char( "Syntax: setclass <class> <field> <value>\r\n", ch ); send_to_char( "Syntax: setclass <class> create\r\n", ch ); send_to_char( "\r\nField being one of:\r\n", ch ); send_to_char( " name filename prime thac0 thac32 nocombo\r\n", ch ); send_to_char( " hpmin hpmax manamin manamax expbase mtitle ftitle\r\n", ch ); send_to_char( " second, deficient affected resist suscept\r\n", ch ); send_to_char( " race starting reclass1 reclass2 reclass3\r\n", ch ); return; } if ( is_number( arg1 ) && ( cl = atoi( arg1 ) ) >= 0 && cl < MAX_CLASS ) Class = class_table[cl]; else { Class = NULL; for ( cl = 0; cl < MAX_CLASS && class_table[cl]; cl++ ) { if ( !class_table[cl]->who_name ) continue; if ( !str_cmp( class_table[cl]->who_name, arg1 ) ) { Class = class_table[cl]; break; } } } if ( !str_cmp( arg2, "create" ) && Class ) { send_to_char( "That class already exists!\r\n", ch ); return; } if ( !Class && str_cmp( arg2, "create" ) ) { send_to_char( "No such class.\r\n", ch ); return; } if ( !str_cmp( arg2, "save" ) ) { DESCRIPTOR_DATA *d; write_class_file( cl ); send_to_char( "&CUpdating class for all players now.\r\n", ch ); for ( d = first_descriptor; d; d = d->next ) { if ( d->character ) update_aris( d->character ); } return; } if ( !str_cmp( arg2, "create" ) ) { if ( MAX_PC_CLASS >= MAX_CLASS ) { send_to_char( "You need to up MAX_CLASS in mud and make clean.\r\n", ch ); return; } if ( ( create_new_class( MAX_PC_CLASS, arg1 ) ) == FALSE ) { send_to_char( "Couldn't create a new class.\r\n", ch ); return; } write_class_file( MAX_PC_CLASS ); MAX_PC_CLASS++; write_class_list( ); send_to_char( "Done.\r\n", ch ); return; } if ( !argument ) { send_to_char( "You must specify an argument.\r\n", ch ); return; } if ( !str_cmp( arg2, "name" ) ) { if ( !VLD_STR( argument ) ) { send_to_char( "Can't set a class name to nothing.\r\n", ch ); return; } if ( VLD_STR( Class->who_name ) ) STRFREE( Class->who_name ); Class->who_name = STRALLOC( ( argument ) ); send_to_char( "Class name is set.\r\n", ch ); return; } if ( !str_cmp( arg2, "filename" ) ) { if ( !VLD_STR( argument ) ) { send_to_char( "Can't set a filename to nothing.\r\n", ch ); return; } if ( VLD_STR( Class->filename ) ) STRFREE( Class->filename ); Class->filename = STRALLOC( ( argument ) ); send_to_char( "Filename is set.\r\n", ch ); return; } if ( !str_cmp( arg2, "starting" ) ) { Class->starting = !Class->starting; ch_printf( ch, "That class is now a %s class.\r\n", Class->starting ? "starting" : "non-starting" ); return; } // Start of the nocombo aurgument! -Taon if ( !str_cmp( arg2, "nocombo" ) ) { for ( i = 0; i < MAX_CLASS; i++ ) { if ( class_table[i] && VLD_STR( class_table[i]->who_name ) ) { if ( !str_cmp( argument, class_table[i]->who_name ) ) { TOGGLE_BIT( Class->combo_restriction, 1 << i ); send_to_char( "Done!\r\n", ch ); send_to_char ( "Note this still isnt complete, as far as the nanny function is concerned!\r\n", ch ); return; } } } return; } if ( !str_cmp( arg2, "race" ) ) { for ( i = 0; i < MAX_RACE; i++ ) { if ( !str_cmp( argument, race_table[i]->race_name ) ) { TOGGLE_BIT( Class->race_restriction, 1 << i ); /* k, that's boggling */ send_to_char( "Done.\r\n", ch ); return; } } send_to_char( "No such race.\r\n", ch ); return; } if ( !str_cmp( arg2, "reclass1" ) ) { Class->reclass1 = 0; for ( i = 0; i < MAX_CLASS; i++ ) { if ( class_table[i] && VLD_STR( class_table[i]->who_name ) ) { if ( !str_cmp( argument, class_table[i]->who_name ) ) { Class->reclass1 = i; send_to_char( "Done.\r\n", ch ); return; } } } send_to_char( "No such class. Reclass1 cleared.\r\n", ch ); return; } if ( !str_cmp( arg2, "reclass2" ) ) { Class->reclass2 = 0; for ( i = 0; i < MAX_CLASS; i++ ) { if ( class_table[i] && VLD_STR( class_table[i]->who_name ) ) { if ( !str_cmp( argument, class_table[i]->who_name ) ) { Class->reclass2 = i; send_to_char( "Done.\r\n", ch ); return; } } } send_to_char( "No such class. Reclass2 cleared.\r\n", ch ); return; } if ( !str_cmp( arg2, "reclass3" ) ) { Class->reclass3 = 0; for ( i = 0; i < MAX_CLASS; i++ ) { if ( class_table[i] && VLD_STR( class_table[i]->who_name ) ) { if ( !str_cmp( argument, class_table[i]->who_name ) ) { Class->reclass3 = i; send_to_char( "Done.\r\n", ch ); return; } } } send_to_char( "No such class. Reclass3 cleared.\r\n", ch ); return; } if ( !str_cmp( arg2, "second" ) ) { int x = get_atype( argument ); if ( x < APPLY_STR || ( x > APPLY_CON && x != APPLY_LCK && x != APPLY_CHA ) ) send_to_char( "Invalid second attribute!\r\n", ch ); else { Class->attr_second = x; send_to_char( "Done.\r\n", ch ); } return; } if ( !str_cmp( arg2, "affected" ) ) { if ( !VLD_STR( argument ) ) { send_to_char( "Usage: setclass <class> affected <flag> [flag]...\r\n", ch ); return; } while ( VLD_STR( argument ) ) { argument = one_argument( argument, arg2 ); value = get_aflag( arg2 ); if ( value < 0 || value > MAX_BITS ) ch_printf( ch, "Unknown flag: %s\r\n", arg2 ); else xTOGGLE_BIT( Class->affected, value ); } send_to_char( "Done.\r\n", ch ); return; } if ( !str_cmp( arg2, "resist" ) ) { if ( !VLD_STR( argument ) ) { send_to_char( "Usage: setclass <class> resist <flag> [flag]...\r\n", ch ); return; } while ( VLD_STR( argument ) ) { argument = one_argument( argument, arg2 ); value = get_risflag( arg2 ); if ( value < 0 || value > 31 ) ch_printf( ch, "Unknown flag: %s\r\n", arg2 ); else TOGGLE_BIT( Class->resist, 1 << value ); } send_to_char( "Done.\r\n", ch ); return; } if ( !str_cmp( arg2, "suscept" ) ) { if ( !VLD_STR( argument ) ) { send_to_char( "Usage: setclass <class> suscept <flag> [flag]...\r\n", ch ); return; } while ( VLD_STR( argument ) ) { argument = one_argument( argument, arg2 ); value = get_risflag( arg2 ); if ( value < 0 || value > 31 ) ch_printf( ch, "Unknown flag: %s\r\n", arg2 ); else TOGGLE_BIT( Class->suscept, 1 << value ); } send_to_char( "Done.\r\n", ch ); return; } if ( !str_cmp( arg2, "deficient" ) ) { int x = get_atype( argument ); if ( x < APPLY_STR || ( x > APPLY_CON && x != APPLY_LCK && x != APPLY_CHA ) ) send_to_char( "Invalid deficient attribute!\r\n", ch ); else { Class->attr_deficient = x; send_to_char( "Done.\r\n", ch ); } return; } if ( !str_cmp( arg2, "prime" ) ) { int x = get_atype( argument ); if ( x < APPLY_STR || ( x > APPLY_CON && x != APPLY_LCK && x != APPLY_CHA ) ) send_to_char( "Invalid prime attribute!\r\n", ch ); else { Class->attr_prime = x; send_to_char( "Done.\r\n", ch ); } return; } if ( !str_cmp( arg2, "thac0" ) ) { Class->thac0_00 = atoi( argument ); send_to_char( "Done.\r\n", ch ); return; } if ( !str_cmp( arg2, "thac32" ) ) { Class->thac0_32 = atoi( argument ); send_to_char( "Done.\r\n", ch ); return; } if ( !str_cmp( arg2, "hpmin" ) ) { Class->hp_min = atoi( argument ); send_to_char( "Done.\r\n", ch ); return; } if ( !str_cmp( arg2, "hpmax" ) ) { Class->hp_max = atoi( argument ); send_to_char( "Done.\r\n", ch ); return; } if ( !str_cmp( arg2, "manamin" ) ) { Class->mana_min = atoi( argument ); send_to_char( "Done.\r\n", ch ); return; } if ( !str_cmp( arg2, "manamax" ) ) { Class->mana_max = atoi( argument ); send_to_char( "Done.\r\n", ch ); return; } if ( !str_cmp( arg2, "expbase" ) ) { Class->exp_base = atoi( argument ); send_to_char( "Done.\r\n", ch ); return; } if ( !str_cmp( arg2, "craftbase" ) ) { Class->craft_base = atoi( argument ); send_to_char( "Craft base is now set.\r\n", ch ); return; } if ( !str_cmp( arg2, "mtitle" ) ) { char arg3[MIL]; int x; argument = one_argument( argument, arg3 ); if ( arg3[0] == '\0' || argument[0] == '\0' ) { send_to_char( "Syntax: setclass <class> mtitle <level> <title>\r\n", ch ); return; } if ( !VLD_STR( argument ) ) { send_to_char( "What would you like to set the mtitle_table to?\r\n", ch ); return; } if ( ( x = atoi( arg3 ) ) < 0 || x > MAX_LEVEL ) { send_to_char( "Invalid level.\r\n", ch ); return; } STRFREE( title_table[cl][x][0] ); title_table[cl][x][0] = STRALLOC( argument ); send_to_char( "Done.\r\n", ch ); return; } if ( !str_cmp( arg2, "ftitle" ) ) { char arg3[MIL]; int x; argument = one_argument( argument, arg3 ); if ( arg3[0] == '\0' || argument[0] == '\0' ) { send_to_char( "Syntax: setclass <class> ftitle <level> <title>\r\n", ch ); return; } if ( !VLD_STR( argument ) ) { send_to_char( "What would you like to set the ftitle_table to?\r\n", ch ); return; } if ( ( x = atoi( arg3 ) ) < 0 || x > MAX_LEVEL ) { send_to_char( "Invalid level.\r\n", ch ); return; } STRFREE( title_table[cl][x][1] ); title_table[cl][x][1] = STRALLOC( argument ); send_to_char( "Done.\r\n", ch ); return; } do_setclass( ch, ( char * ) "" ); return; }