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OAC U7BN4TQ36FIOAGBVWQ4A6VXFZN2GETLGCLD4E3MCBA7OQ3TXYUXQC NVSFIV2ZKP44XHCSCXG6OZVGL67OIFINC34J2EMKTA4KULCERUEAC BPPMLLPJLP6W2LZSPAMOMYA7YWCIFJTNNL3XBWU2MRHAQBZ5M4XAC R6XS2HO5QX2FJUGL5UQQRNETKCMYWTUFPHPPS5SYWK3OQA4UDUQQC int item_list::parse_acquirement_source(const std::string &source){const std::string god_name(replace_all_of(source, "_", " "));const god_type god(string_to_god(god_name.c_str(), true));if (god == GOD_NO_GOD)error = make_stringf("unknown god name: '%s'", god_name.c_str());return (god);}
const std::string acquirement_source = strip_tag_prefix(s, "acquire:");if (!acquirement_source.empty() || strip_tag(s, "acquire")){if (!acquirement_source.empty())result.acquirement_source =parse_acquirement_source(acquirement_source);// If requesting acquirement, must specify item base type or// "any".result.level = ISPEC_ACQUIREMENT;if (s == "any")result.base_type = OBJ_RANDOM;elseparse_random_by_class(s, result);return (result);}
ASSERT(!crawl_state.arena);int thing_created = NON_ITEM;if (item_index == NULL)item_index = &thing_created;*item_index = NON_ITEM;while (class_wanted == OBJ_RANDOM){ASSERT(!quiet);mesclr();mpr("[a] Weapon [b] Armour [c] Jewellery [d] Book");mpr("[e] Staff [f] Wand [g] Miscellaneous [h] Food [i] Gold");mpr("What kind of item would you like to acquire? ", MSGCH_PROMPT);const int keyin = tolower( get_ch() );switch (keyin){case 'a': case ')': class_wanted = OBJ_WEAPONS; break;case 'b': case '[': case ']': class_wanted = OBJ_ARMOUR; break;case 'c': case '=': case '"': class_wanted = OBJ_JEWELLERY; break;case 'd': case '+': case ':': class_wanted = OBJ_BOOKS; break;case 'e': case '\\': case '|': class_wanted = OBJ_STAVES; break;case 'f': case '/': class_wanted = OBJ_WANDS; break;case 'g': case '}': case '{': class_wanted = OBJ_MISCELLANY; break;case 'h': case '%': class_wanted = OBJ_FOOD; break;case 'i': case '$': class_wanted = OBJ_GOLD; break;default:// Lets wizards escape out of accidently choosing acquirement.if (agent == AQ_WIZMODE){canned_msg(MSG_OK);return (false);}#if defined(USE_UNIX_SIGNALS) && defined(SIGHUP_SAVE) && defined(USE_CURSES)// If we've gotten a HUP signal then the player will be unable// to make a selection.if (crawl_state.seen_hups){mpr("Acquirement interrupted by HUP signal.", MSGCH_ERROR);you.turn_is_over = false;return (false);}#endifbreak;}}if (grid_destroys_items(grd(you.pos()))){// How sad (and stupid).if (!silenced(you.pos()) && !quiet)mprf(MSGCH_SOUND, grid_item_destruction_message(grd(you.pos())));if (agent > GOD_NO_GOD && agent < NUM_GODS){if (agent == GOD_XOM)simple_god_message(" snickers.", GOD_XOM);else{ASSERT(!"God gave gift item while player was on grid which ""destroys items.");mprf(MSGCH_ERROR, "%s gave a god gift while you were on ""terrain which destroys items.",god_name((god_type) agent).c_str());}}*item_index = NON_ITEM;
if (!quiet)mpr("The demon of the infinite void smiles upon you.");return (NON_ITEM);}
// Well, the item may have fallen in the drink, but the intent is// that acquirement happened. -- bwrreturn (true);}
int acquirement_create_item(object_class_type class_wanted,int agent,bool quiet,const coord_def &pos){ASSERT(class_wanted != OBJ_RANDOM);
if (thing_created != NON_ITEM)
if (thing_created != NON_ITEM && !quiet)canned_msg(MSG_SOMETHING_APPEARS);return (thing_created);}bool acquirement(object_class_type class_wanted, int agent,bool quiet, int* item_index){ASSERT(!crawl_state.arena);int thing_created = NON_ITEM;if (item_index == NULL)item_index = &thing_created;*item_index = NON_ITEM;while (class_wanted == OBJ_RANDOM){ASSERT(!quiet);mesclr();mpr("[a] Weapon [b] Armour [c] Jewellery [d] Book");mpr("[e] Staff [f] Wand [g] Miscellaneous [h] Food [i] Gold");mpr("What kind of item would you like to acquire? ", MSGCH_PROMPT);const int keyin = tolower( get_ch() );switch (keyin){case 'a': case ')': class_wanted = OBJ_WEAPONS; break;case 'b': case '[': case ']': class_wanted = OBJ_ARMOUR; break;case 'c': case '=': case '"': class_wanted = OBJ_JEWELLERY; break;case 'd': case '+': case ':': class_wanted = OBJ_BOOKS; break;case 'e': case '\\': case '|': class_wanted = OBJ_STAVES; break;case 'f': case '/': class_wanted = OBJ_WANDS; break;case 'g': case '}': case '{': class_wanted = OBJ_MISCELLANY; break;case 'h': case '%': class_wanted = OBJ_FOOD; break;case 'i': case '$': class_wanted = OBJ_GOLD; break;default:// Lets wizards escape out of accidently choosing acquirement.if (agent == AQ_WIZMODE){canned_msg(MSG_OK);return (false);}#if defined(USE_UNIX_SIGNALS) && defined(SIGHUP_SAVE) && defined(USE_CURSES)// If we've gotten a HUP signal then the player will be unable// to make a selection.if (crawl_state.seen_hups){mpr("Acquirement interrupted by HUP signal.", MSGCH_ERROR);you.turn_is_over = false;return (false);}#endifbreak;}}if (grid_destroys_items(grd(you.pos())))
if (!quiet)canned_msg(MSG_SOMETHING_APPEARS);
// How sad (and stupid).if (!silenced(you.pos()) && !quiet)mprf(MSGCH_SOUND, grid_item_destruction_message(grd(you.pos())));if (agent > GOD_NO_GOD && agent < NUM_GODS){if (agent == GOD_XOM)simple_god_message(" snickers.", GOD_XOM);else{ASSERT(!"God gave gift item while player was on grid which ""destroys items.");mprf(MSGCH_ERROR, "%s gave a god gift while you were on ""terrain which destroys items.",god_name((god_type) agent).c_str());}}*item_index = NON_ITEM;// Well, the item may have fallen in the drink, but the intent is// that acquirement happened. -- bwrreturn (true);
// Well, the item may have fallen in the drink, but the intent is// that acquirement happened. -- bwrreturn (true);
*item_index =acquirement_create_item(class_wanted, agent, quiet, you.pos());return (*item_index != NON_ITEM);
const int item_made = items( spec.allow_uniques, base_type,spec.sub_type, true, level, spec.race, 0,spec.ego );
const int item_made =(acquire ?acquirement_create_item(base_type, spec.acquirement_source,true, where): items( spec.allow_uniques, base_type,spec.sub_type, true, level, spec.race, 0,spec.ego ));
* "acquire" requests the use of the acquirement code itself,ensuring that the player gets wearable armour, etc. You canalso use acquire:<god> to request that the acquired item betreated as a god gift. Examples: "acquire any", "acquire armour","acquire:sif_muna book", "acquire:trog weapon".