void Menu::draw(sf::RenderWindow* w) { sf::Sprite health(healthIcon_); health.setPosition(IMAGE_X + ICON_SIZE/2, HEALTH_Y + ICON_SIZE/2); w->draw(health); sf::Sprite armor(armorIcon_); armor.setPosition(IMAGE_X + ICON_SIZE/2, ARMOR_Y + ICON_SIZE/2); w->draw(armor); w->draw(healthText_); w->draw(meleeText_); w->draw(rangeText_); w->draw(magicText_); w->draw(armorText_); }
bool GadgetArmor::needRepair( Noun * pWhom ) const { if ( NounGadget::needRepair(pWhom) ) return true; return armor() < maxArmor(); }
float GadgetArmor::addMass() const { return armor() / 250000.0f; }
CharString GadgetArmor::status() const { return CharString().format("%d%%", ((armor() * 100) / maxArmor()) ); }
int generate_DH (void) { #ifdef USE_RSAREF R_DH_PARAMS DH_parms; unsigned char tmp, ID[16]; unsigned char prime[DH_PRIME_LEN (MIX_DH_PRIME)], generator[DH_PRIME_LEN (MIX_DH_PRIME)]; int i, err; BUFFER *buff; R_DIGEST_CTX context; FILE *dhfile, *dhlock; fprintf (errlog, "Now making the DH parameters. This may take a while.\n"); mix_lock ("DH", &dhlock); if ((dhfile = open_mix_file ("DH.mix", "w")) == NULL) { mix_unlock ("DH", dhlock); return (-1); } DH_parms.prime = prime; DH_parms.generator = generator; err = R_GenerateDHParams (&DH_parms, MIX_DH_PRIME, MIX_DH_SUB, &random_obj); if (err != 0) { fprintf (errlog, "Error: DH param generator error.\n"); fprintf (errlog, "err = %d, modlen = %d, randerr = %d\n", err, RE_MODULUS_LEN, RE_NEED_RANDOM); return (-1); } /* Make Key ID */ R_DigestInit (&context, DA_MD5); R_DigestUpdate (&context, DH_parms.prime, sizeof (prime)); R_DigestUpdate (&context, DH_parms.generator, sizeof (generator)); R_DigestFinal (&context, ID, &i); buff = new_buffer (); tmp = DH_parms.primeLen; add_to_buffer (buff, &tmp, 1); add_to_buffer (buff, DH_parms.prime, DH_parms.primeLen); tmp = DH_parms.generatorLen; add_to_buffer (buff, &tmp, 1); add_to_buffer (buff, DH_parms.generator, DH_parms.generatorLen); fprintf (dhfile, "%s\n", begin_key); print_ID (dhfile, ID); fprintf (dhfile, "%d\n", (int) buff->length); /* Armor DH_parms */ armor (buff); write_buffer (buff, dhfile); free_buffer (buff); fprintf (dhfile, "%s\n", end_key); fclose (dhfile); mix_unlock ("DH", dhlock); return (0); #else /* not implemented */ return (-1); #endif }
void write_keyfile (void) { /* read the public keys from secring.mix... */ FILE *privring, *privlock; FILE *keyfile, *keylock, *keyinfo; BUFFER *b1, *buff, *header; #ifdef NEW BUFFER *signature; #endif char line[1024], IDstr[80]; long pos; int i, len; byte tmpbyte; PRIVATE_KEY privkey; unsigned char ID[16]; char abilities[256] = ""; #ifndef USE_RSAREF A_PKCS_RSA_PRIVATE_KEY *pkinfo; #endif our_abilities (abilities); mix_lock ("secring", &privlock); if ((privring = open_mix_file (SECRING, "r+")) == NULL) { mix_unlock ("secring", privlock); return; } buff = new_buffer (); #ifdef NEW str_to_buffer (buff, begin_signed); str_to_buffer (buff, "\n"); #endif while ((pos = next_key (privring)) != -1) { header = new_buffer (); for (;;) /* copy the header and to a buffer */ { getline (line, sizeof (line), privring); if (!strstr (line, ": ")) break; str_to_buffer (header, line); } if (read_priv_key (privring, &privkey, ID) != 0) break; encode_ID (IDstr, ID); if (memcmp (line, IDstr, 32) != 0) { fprintf (errlog, "Error: Private Key IDs do not match! Bad passphrase?\n"); fclose (privring); mix_unlock ("secring", privlock); exit (-1); } /* write key to buff */ if (header->length == 0) { /* old format */ sprintf (line, "%s %s ", SHORTNAME, REMAILERADDR); str_to_buffer (buff, line); str_to_buffer (buff, IDstr); str_to_buffer (buff, " "); str_to_buffer (buff, mixmaster_protocol); str_to_buffer (buff, VERSION); str_to_buffer (buff, " "); str_to_buffer (buff, abilities); str_to_buffer (buff, "\n\n"); str_to_buffer (buff, begin_key); str_to_buffer (buff, "\n"); } else { str_to_buffer (buff, begin_key); str_to_buffer (buff, "\n"); add_to_buffer (buff, header->message, header->length); } str_to_buffer (buff, IDstr); str_to_buffer (buff, "\n"); free_buffer (header); /* Armor pubkey */ b1 = new_buffer (); #ifdef USE_RSAREF /* Convert pubkey.bits to two bytes */ i = privkey.bits; #else B_GetKeyInfo ((POINTER *) & pkinfo, privkey, KI_PKCS_RSAPrivate); i = pkinfo->modulus.len * 8; #endif tmpbyte = i & 0xFF; add_to_buffer (b1, &tmpbyte, 1); /* low byte of bits */ i = i / 256; tmpbyte = i & 0xFF; add_to_buffer (b1, &tmpbyte, 1); /* high byte of bits */ #ifdef USE_RSAREF add_to_buffer (b1, privkey.modulus, MAX_RSA_MODULUS_LEN); add_to_buffer (b1, privkey.publicExponent, MAX_RSA_MODULUS_LEN); #else add_to_buffer (b1, pkinfo->modulus.data, pkinfo->modulus.len); if (pkinfo->publicExponent.len < pkinfo->modulus.len) add_to_buffer (b1, NULL, pkinfo->modulus.len - pkinfo->publicExponent.len); add_to_buffer (b1, pkinfo->publicExponent.data, pkinfo->publicExponent.len); #endif len = b1->length; while ((b1->length % 3) != 0) str_to_buffer (b1, "X"); sprintf (line, "%d\n", len); str_to_buffer (buff, line); armor (b1); add_to_buffer (buff, b1->message, b1->length); free_buffer (b1); str_to_buffer (buff, end_key); str_to_buffer (buff, "\n"); } fclose (privring); mix_unlock ("secring", privlock); #ifdef NEW str_to_buffer (buff, begin_cfg); sprintf (line, "\n%s%s\n", KEY_VERSION, VERSION); str_to_buffer (buff, line); sprintf (line, "%s%s\n", CFG_REMAILER, SHORTNAME); str_to_buffer (buff, line); sprintf (line, "%s%s\n", CFG_ADDRESS, REMAILERADDR); str_to_buffer (buff, line); sprintf (line, "%s%s\n", CFG_ABILITIES, abilities); str_to_buffer (buff, line); sprintf (line, "%s%lu\n", CFG_DATE, (unsigned long) time (NULL)); str_to_buffer (buff, line); str_to_buffer (buff, end_cfg); signature = new_buffer (); create_sig (buff, signature); armor (signature); str_to_buffer (buff, "\n"); str_to_buffer (buff, begin_signature); str_to_buffer (buff, "\n"); add_to_buffer (buff, signature->message, signature->length); str_to_buffer (buff, end_signature); #endif mix_lock ("key", &keylock); if ((keyinfo = open_mix_file (KEYINFO, "r")) == NULL || (keyfile = open_mix_file (KEYFILE, "w")) == NULL) { mix_unlock ("key", keylock); return; } while (getline (line, sizeof (line), keyinfo) != NULL) fprintf (keyfile, "%s\n", line); fclose (keyinfo); write_buffer (buff, keyfile); fclose (keyfile); mix_unlock ("key", keylock); free_buffer (buff); }
int generate_key (const char *header) { PUBLIC_KEY pubkey; PRIVATE_KEY privkey; unsigned char line[1024]; int i, err, len; unsigned char iv[8]; byte digest[16], ID[16], tmpbyte; byte des3key[24]; BUFFER *b1, *encrypted_key; FILE *privring, *privlock; #ifdef USE_RSAREF R_DIGEST_CTX digest_context; DES3_CBC_CTX context; R_RSA_PROTO_KEY protokey; #else B_ALGORITHM_OBJ digest_obj; B_ALGORITHM_OBJ des_obj; B_ALGORITHM_OBJ gen_obj; B_KEY_OBJ key_obj; A_RSA_KEY_GEN_PARAMS keypar; A_PKCS_RSA_PRIVATE_KEY *keyinfo; unsigned char pubexpt[] = {1, 0, 1}; #endif #ifdef DEBUG printf ("Generating key:\n%s", header); #endif /* Generate a 1024 bit key with pub exponent = 65537 */ #ifdef USE_RSAREF protokey.bits = MIX_RSA_MOD; protokey.useFermat4 = 1; err = R_GeneratePEMKeys (&pubkey, &privkey, &protokey, &random_obj); #else B_CreateAlgorithmObject (&gen_obj); /* Generate a 1024 bit key with pub exponent = 65537 */ keypar.modulusBits = 1024; keypar.publicExponent.data = pubexpt; keypar.publicExponent.len = sizeof (pubexpt); B_SetAlgorithmInfo (gen_obj, AI_RSAKeyGen, (POINTER) & keypar); B_GenerateInit (gen_obj, CHOOSER, NULL); B_CreateKeyObject (&pubkey); B_CreateKeyObject (&privkey); err = (B_GenerateKeypair (gen_obj, pubkey, privkey, random_obj, NULL)); #endif if (err != 0) { fprintf (errlog, "Key generation error.\n"); return (-1); } #ifdef DEBUG printf ("Done.\n"); #endif /* put private key in a buffer */ b1 = new_buffer (); #ifdef USE_RSAREF /* Convert privkey.bits to two bytes */ i = privkey.bits; #else B_GetKeyInfo ((POINTER *) & keyinfo, privkey, KI_PKCS_RSAPrivate); i = keyinfo->modulus.len * 8; #endif tmpbyte = i & 0xFF; add_to_buffer (b1, &tmpbyte, 1); /* low byte of bits */ tmpbyte = (i / 256) & 0xFF; add_to_buffer (b1, &tmpbyte, 1); /* high byte of bits */ #ifdef USE_RSAREF add_to_buffer (b1, privkey.modulus, MAX_RSA_MODULUS_LEN); add_to_buffer (b1, privkey.publicExponent, MAX_RSA_MODULUS_LEN); /* Make Key ID */ R_DigestInit (&digest_context, DA_MD5); R_DigestUpdate (&digest_context, pubkey.modulus, MAX_RSA_MODULUS_LEN); R_DigestUpdate (&digest_context, pubkey.exponent, MAX_RSA_MODULUS_LEN); R_DigestFinal (&digest_context, ID, &i); add_to_buffer (b1, privkey.exponent, MAX_RSA_MODULUS_LEN); add_to_buffer (b1, privkey.prime[0], MAX_RSA_PRIME_LEN); add_to_buffer (b1, privkey.prime[1], MAX_RSA_PRIME_LEN); add_to_buffer (b1, privkey.primeExponent[0], MAX_RSA_PRIME_LEN); add_to_buffer (b1, privkey.primeExponent[1], MAX_RSA_PRIME_LEN); add_to_buffer (b1, privkey.coefficient, MAX_RSA_PRIME_LEN); #else i = (i + 7) / 8; /* Make Key ID */ B_CreateAlgorithmObject (&digest_obj); B_SetAlgorithmInfo (digest_obj, AI_MD5, NULL); B_DigestInit (digest_obj, NULL, CHOOSER, NULL); add_to_buffer (b1, keyinfo->modulus.data, i); if (keyinfo->publicExponent.len < i) add_to_buffer (b1, NULL, i - keyinfo->publicExponent.len); add_to_buffer (b1, keyinfo->publicExponent.data, keyinfo->publicExponent.len); B_DigestUpdate (digest_obj, b1->message + 2, 2 * i, NULL); B_DigestFinal (digest_obj, ID, &i, 16, NULL); B_DestroyAlgorithmObject (&digest_obj); if (keyinfo->privateExponent.len < i) add_to_buffer (b1, NULL, i - keyinfo->privateExponent.len); add_to_buffer (b1, keyinfo->privateExponent.data, keyinfo->privateExponent.len); i = (i + 1) / 2; if (keyinfo->prime[0].len < i) add_to_buffer (b1, NULL, i - keyinfo->prime[0].len); add_to_buffer (b1, keyinfo->prime[0].data, keyinfo->prime[0].len); if (keyinfo->prime[1].len < i) add_to_buffer (b1, NULL, i - keyinfo->prime[1].len); add_to_buffer (b1, keyinfo->prime[1].data, keyinfo->prime[1].len); if (keyinfo->primeExponent[0].len < i) add_to_buffer (b1, NULL, i - keyinfo->primeExponent[0].len); add_to_buffer (b1, keyinfo->primeExponent[0].data, keyinfo->primeExponent[0].len); if (keyinfo->primeExponent[1].len < i) add_to_buffer (b1, NULL, i - keyinfo->primeExponent[1].len); add_to_buffer (b1, keyinfo->primeExponent[1].data, keyinfo->primeExponent[1].len); if (keyinfo->coefficient.len < i) add_to_buffer (b1, NULL, i - keyinfo->coefficient.len); add_to_buffer (b1, keyinfo->coefficient.data, keyinfo->coefficient.len); #endif /* Encrypt the secret key */ encrypted_key = new_buffer (); len = b1->length; if (len % 8 != 0) /* ensure length is mult of 8 */ len += 8 - len % 8; add_to_buffer (encrypted_key, malloc (len), len); our_randombytes (iv, 8); #ifdef USE_RSAREF R_DigestInit (&digest_context, DA_MD5); R_DigestUpdate (&digest_context, PASSPHRASE, strlen (PASSPHRASE)); R_DigestFinal (&digest_context, digest, &i); memcpy (des3key, digest, 16); /* set first 2 keys */ memcpy (des3key + 16, digest, 8); /* third key = first key */ DES3_CBCInit (&context, des3key, iv, 1); if (DES3_CBCUpdate (&context, encrypted_key->message, b1->message, encrypted_key->length)) { printf ("Error: Problem encrypting key\n"); return (-1); } #else B_CreateAlgorithmObject (&digest_obj); B_SetAlgorithmInfo (digest_obj, AI_MD5, NULL); B_DigestInit (digest_obj, NULL, CHOOSER, NULL); B_DigestUpdate (digest_obj, PASSPHRASE, strlen (PASSPHRASE), NULL); B_DigestFinal (digest_obj, digest, &i, 16, NULL); B_DestroyAlgorithmObject (&digest_obj); memcpy (des3key, digest, 16); /* set first 2 keys */ memcpy (des3key + 16, digest, 8); /* third key = first key */ B_CreateAlgorithmObject (&des_obj); B_SetAlgorithmInfo (des_obj, AI_DES_EDE3_CBC_IV8, iv); B_CreateKeyObject (&key_obj); B_SetKeyInfo (key_obj, KI_DES24Strong, des3key); B_EncryptInit (des_obj, key_obj, CHOOSER, NULL); B_EncryptUpdate (des_obj, encrypted_key->message, &len, encrypted_key->length, b1->message, b1->length, random_obj, NULL); B_EncryptFinal (des_obj, encrypted_key->message + len, &len, encrypted_key->length - len, random_obj, NULL); /* err? XXX */ #endif memset ((void *) digest, 0, 16); /* zero password */ mix_lock ("secring", &privlock); if ((privring = open_mix_file (SECRING, "a+")) == NULL) { mix_unlock ("secring", privlock); return (-1); } fprintf (privring, "%s\n", begin_key); if (strlen (header) > 0) { fprintf (privring, KEY_VERSION "%s\n", VERSION); fprintf (privring, "%s", header); } print_ID (privring, ID); fprintf (privring, "%d\n", len); encode_block (line, &i, iv, 8); fwrite (line, 1, i, privring); fprintf (privring, "\n"); /* Armor privkey */ armor (encrypted_key); write_buffer (encrypted_key, privring); free_buffer (encrypted_key); fprintf (privring, "%s\n", end_key); fclose (privring); mix_unlock ("secring", privlock); return 0; }
Ultra1::StateNumber Ultra1::HelpState::Run( ) { Sim::Image bg( UBD_PREFIX "/images/mountains.jpg" ); Sim::Image but( UBD_PREFIX "/images/button.png", 255, 0, 0 ); Sim::Button menu( 0, 480, 450, 50, 3, 0, 0, 0, 40, 7, true ); menu.SetBackGround( but.image ); menu.SetForeGround( "Main Menu", app->text_writer.GetFont( GALAPOGO_36 ), 0, 0, 0 ); Sim::Button quit( 0, 540, 450, 50, 3, 0, 0, 0, 40, 7, true ); quit.SetBackGround( but.image ); quit.SetForeGround( "Quit", app->text_writer.GetFont( GALAPOGO_36 ), 0, 0, 0 ); Sim::Image bear_i( UBD_PREFIX "/images/bear.png", 0, 0, 255 ); Sim::Sprite bear( 10, 130, 20, 40, 1 ); bear.AddAnimation( 0, 0, 3, true, bear_i.image, 200, true ); Sim::Image armor_i( UBD_PREFIX "/images/armor.png", 0, 0, 255 ); Sim::Sprite armor( 10, 190, 20, 20, 1 ); armor.AddAnimation( 0, 0, 2, true, armor_i.image, 125, false ); Sim::Image force_i( UBD_PREFIX "/images/force.png", 0, 0, 255 ); Sim::Sprite force( 10, 230, 20, 20, 1 ); force.AddAnimation( 0, 0, 2, true, force_i.image, 125, false ); Sim::Image life_i( UBD_PREFIX "/images/extralife.png", 0, 0, 255 ); Sim::Sprite life( 10, 270, 20, 20, 1 ); life.AddAnimation( 0, 0, 2, true, life_i.image, 125, false ); Sim::Image coin_i( UBD_PREFIX "/images/coin.png", 0, 0, 255 ); Sim::Sprite coin( 10, 310, 20, 20, 1 ); coin.AddAnimation( 0, 0, 3, true, coin_i.image, 125, false ); SDL_Event event; while( true ) { while( SDL_PollEvent(&event) ) { if( event.type == SDL_QUIT ) { app->FadeTo( 100 ); return QUIT_STATE; } else if( event.type == SDL_KEYDOWN ) { if( event.key.keysym.sym == SDLK_ESCAPE ) { app->FadeTo( 100 ); return MENU_STATE; } } else if( event.type == SDL_MOUSEBUTTONDOWN ) { menu.HandleMouseDown( event.button.x, event.button.y ); quit.HandleMouseDown( event.button.x, event.button.y ); } else if( event.type == SDL_MOUSEBUTTONUP ) { if( menu.HandleMouseUp( event.button.x, event.button.y ) ) { app->PlaySound( BUTTON_NOISE ); app->FadeTo( 100 ); return MENU_STATE; } if( quit.HandleMouseUp( event.button.x, event.button.y ) ) { app->PlaySound( BUTTON_NOISE ); app->FadeTo( 100 ); return QUIT_STATE; } } } bear.Update( ); armor.Update( ); force.Update( ); life.Update( ); coin.Update( ); app->Clear( 0, 0, 0 ); SDL_BlitSurface( bg.image, NULL, app->screen, NULL ); app->text_writer.WriteText( app->screen, GALAPOGO_72, "Help", 10, 0, 0, 0, 0 ); // Write basic info at top... app->text_writer.WriteText( app->screen, PLAIN_FONT_14, "In this game, you must guide Ultra Bear to the South Pole by working through every level on the map.", 10, 65, 0, 0, 0 ); app->text_writer.WriteText( app->screen, PLAIN_FONT_14, "To beat a level, you must move Ultra Bear to the right while avoiding all of the enemies. You can kill", 10, 82, 0, 0, 0 ); app->text_writer.WriteText( app->screen, PLAIN_FONT_14, "enemies by bouncing on their heads. Here are a few things that you will encounter:", 10, 99, 0,0,0 ); // Info beside UB and crew... app->text_writer.WriteText( app->screen, PLAIN_FONT_14, "Ultra Bear. This is the bear you must guide south. He is very Ultra.", 50, 139, 0, 0, 0 ); app->text_writer.WriteText( app->screen, PLAIN_FONT_14, "Armor. This pickup will protect Ultra Bear from one blow by an enemy.", 50, 190, 0, 0, 0 ); app->text_writer.WriteText( app->screen, PLAIN_FONT_14, "Force. This magic force field will eliminate all enemies Ultra Bear touches. It will wear off though.", 50, 230, 0, 0, 0 ); app->text_writer.WriteText( app->screen, PLAIN_FONT_14, "Extra Life. This pickup will credit Ultra Bear with one extra life.", 50, 270, 0, 0, 0 ); app->text_writer.WriteText( app->screen, PLAIN_FONT_14, "Coin. This pickup deposits one coin in Ultra Bear's account. Once he has 100, he can trade them in for an extra life.", 50, 310, 0, 0, 0 ); app->text_writer.WriteText( app->screen, PLAIN_FONT_14, "The controls can be configured by clicking Options from the Main Menu", 10, 380, 0, 0, 0 ); menu.Draw( app->screen ); quit.Draw( app->screen ); bear.Draw( app->screen ); armor.Draw( app->screen ); force.Draw( app->screen ); life.Draw( app->screen ); coin.Draw( app->screen ); app->Flip( ); } }
bool Player::doInput(std::string s) { // Create 2 new arrays, each to hold a word. std::string args[2]; // Put words into arrays int divisionpoint = s.find(" "); args[0] = s.substr(0,divisionpoint); args[1] = s.substr(divisionpoint+1); // Make the strings lowercase so they can be checked without being case sensitive. for (int i = 0; i < 16; i++) {if (args[0][i] <='Z' && args[0][i]>='A') args[0][i] -= ('Z'-'z');} // Convert string to lowercase. for (int i = 0; i < 16; i++) {if (args[1][i] <='Z' && args[1][i]>='A') args[1][i] -= ('Z'-'z');} // Convert string to lowercase. // Base input checker, takes the first word and uses the switch to call the needed function if (args[0] == "eat") goto eat; else if (args[0] == "get") goto get; else if (args[0] == "drop") goto drop; else if (args[0] == "go") goto go; else if (args[0] == "attack") goto attack; else if (args[0] == "search") {location->searchRoom(); return false;} else if (args[0] == "inventory") {checkInventory(); return false;} else if (args[0] == "health") {showHealth(); return false;} else if (args[0] == "weapon") goto weapon; else if (args[0] == "armor") goto armor; else if (args[0] == "suicide") {suicide(); return false;} else if (args[0] == "help") goto help; else {std::cout << "Unknown command, use 'help' to view commands.\n"; return false;} eat: if (args[1] == "0") {eat(0); return true;} else if (args[1] == "1") {eat(1); return true;} else if (args[1] == "2") {eat(2); return true;} else if (args[1] == "3") {eat(3); return true;} else if (args[1] == "4") {eat(4); return true;} else if (args[1] == "5") {eat(5); return true;} else if (args[1] == "6") {eat(6); return true;} else if (args[1] == "7") {eat(7); return true;} else if (args[1] == "8") {eat(8); return true;} else if (args[1] == "9") {eat(9); return true;} else {std::cout << "Invalid argument for 'eat'.\nValid arguments for 'eat' are numbers 0-9.\n"; return false;} get: if (args[1] == "0") {get(0); return true;} else if (args[1] == "1") {get(1); return true;} else if (args[1] == "2") {get(2); return true;} else if (args[1] == "3") {get(3); return true;} else if (args[1] == "4") {get(4); return true;} else if (args[1] == "5") {get(5); return true;} else if (args[1] == "6") {get(6); return true;} else if (args[1] == "7") {get(7); return true;} else if (args[1] == "8") {get(8); return true;} else if (args[1] == "9") {get(9); return true;} else {std::cout << "Invalid argument for 'get'.\nValid arguments for 'get' are numbers 0-9.\n"; return false;} drop: if (args[1] == "0") {drop(0); return true;} else if (args[1] == "1") {drop(1); return true;} else if (args[1] == "2") {drop(2); return true;} else if (args[1] == "3") {drop(3); return true;} else if (args[1] == "4") {drop(4); return true;} else if (args[1] == "5") {drop(5); return true;} else if (args[1] == "6") {drop(6); return true;} else if (args[1] == "7") {drop(7); return true;} else if (args[1] == "8") {drop(8); return true;} else if (args[1] == "9") {drop(9); return true;} else {std::cout << "Invalid argument for 'drop'.\nValid arguments for 'drop' are numbers 0-9.\n"; return false;} go: if (args[1] == "n") {go(0); return true;} else if (args[1] == "s") {go(1); return true;} else if (args[1] == "e") {go(2); return true;} else if (args[1] == "w") {go(3); return true;} else {std::cout << "Invalid argument for 'go'.\nValid arguments for 'go' are 'n', 's', 'e', and 'w'.\n"; return false;} attack: if (args[1] == "0") {attack(0); return true;} else if (args[1] == "1") {attack(1); return true;} else if (args[1] == "2") {attack(2); return true;} else if (args[1] == "3") {attack(3); return true;} else if (args[1] == "4") {attack(4); return true;} else {std::cout << "Invalid argument for 'attack'.\nValid arguments for 'attack' are numbers 0-4.\n"; return false;} weapon: if (args[1] == "0") {weapon(0); return true;} else if (args[1] == "1") {weapon(1); return true;} else if (args[1] == "2") {weapon(2); return true;} else if (args[1] == "3") {weapon(3); return true;} else if (args[1] == "4") {weapon(4); return true;} else if (args[1] == "5") {weapon(5); return true;} else if (args[1] == "6") {weapon(6); return true;} else if (args[1] == "7") {weapon(7); return true;} else if (args[1] == "8") {weapon(8); return true;} else if (args[1] == "9") {weapon(9); return true;} else {std::cout << "Invalid argument for 'weapon'.\nValid arguments for 'weapon' are numbers 0-9.\n"; return false;} armor: if (args[1] == "0") {armor(0); return true;} else if (args[1] == "1") {armor(1); return true;} else if (args[1] == "2") {armor(2); return true;} else if (args[1] == "3") {armor(3); return true;} else if (args[1] == "4") {armor(4); return true;} else if (args[1] == "5") {armor(5); return true;} else if (args[1] == "6") {armor(6); return true;} else if (args[1] == "7") {armor(7); return true;} else if (args[1] == "8") {armor(8); return true;} else if (args[1] == "9") {armor(9); return true;} else {std::cout << "Invalid argument for 'armor'.\nValid arguments for 'armor' are numbers 0-9.\n"; return false;} help: std::cout << "Valid commands are 'eat', 'get', 'drop', 'go', 'attack', 'search', 'inventory', 'health', 'weapon', 'armor', 'suicide', and 'help'.\n"; return false; }