void record_monst(cCreature *which_m) { short r1; char str[60]; r1 = get_ran(1,1,100); r1 = (r1 * 7) / 10; if ((which_m->x_width > 1) || (which_m->y_width > 1)) { ASB("Capture Soul: Monster is too big."); } else if ((r1 > charm_odds[which_m->level / 2]) || (which_m->spec_skill == 12) || (which_m->m_type == 3)) { monst_spell_note(which_m->number,10); play_sound(68); } else { monst_spell_note(which_m->number,24); r1 = get_ran(1,0,3); if (univ.party.imprisoned_monst[r1] == 0) univ.party.imprisoned_monst[r1] = which_m->number; else { r1 = get_ran(1,0,3); univ.party.imprisoned_monst[r1] = which_m->number; } ASB("Capture Soul: Success!"); sprintf((char *)str," Caught in slot %d.",r1 + 1); add_string_to_buf((char *)str); play_sound(53); } }
bool pc_record_type::giveToPC(item_record_type item, bool print_result) { short free_space; char announce_string[60]; if (item.variety == ITEM_TYPE_NO_ITEM) return true; if (item.variety == ITEM_TYPE_GOLD) { party.gold += item.item_level; ASB("You get some gold."); return true; } if (item.variety == ITEM_TYPE_FOOD) { party.food += item.item_level; ASB("You get some food."); return true; } if (item_weight(item) > amountCanCarry() - amountCarried()) { if (print_result == true) { MessageBeep(MB_OK); ASB("Item too heavy to carry."); } return false; } if (((free_space = hasSpace()) == 24) || (!isAlive())) return false; else { item.item_properties = item.item_properties & 253; // not property item.item_properties = item.item_properties & 247; // not contained items[free_space] = item; if (print_result == 1) { if (stat_window == getNum()) put_item_screen(stat_window,0); } if (in_startup_mode == false) { if (item.isIdent() == false) sprintf((char *) announce_string," %s gets %s.",name,item.name); else sprintf((char *) announce_string," %s gets %s.",name,item.full_name); if (print_result) add_string_to_buf((char *)announce_string); } combineThings(); sortItems(); return true; } return false; }
void talk_notes() { short i,item_hit; store_num_i = 0; for (i = 0; i < 120; i++) if (univ.party.talk_save[i].personality != -1) store_num_i = i + 1; store_page_on = 0; if (store_num_i == 0) { ASB("Nothing in your talk journal."); print_buf(); return; } make_cursor_sword(); cd_create_dialog_parent_num(960,0); put_talk(); if (store_num_i == 1) { cd_activate_item(960,10,0); cd_activate_item(960,11,0); } item_hit = cd_run_dialog(); cd_kill_dialog(960); }
void pc_record_type::combineThings() { int i,j,test; for (i = 0; i < 24; i++) { if ((items[i].variety > ITEM_TYPE_NO_ITEM) && (items[i].type_flag > 0) && (items[i].isIdent())) { for (j = i + 1; j < 24; j++) if ((items[j].variety > ITEM_TYPE_NO_ITEM) && (items[j].type_flag == items[i].type_flag) && (items[j].isIdent())) { add_string_to_buf("(items combined)"); test = items[i].charges + items[j].charges; if (test > 125) { items[i].charges = 125; ASB("(Can have at most 125 of any item."); } else items[i].charges += items[j].charges; if (equip[j] == true) { equip[i] = true; equip[j] = false; } takeItem(30 + j); } } if ((items[i].variety > ITEM_TYPE_NO_ITEM) && (items[i].charges < 0)) items[i].charges = 1; } }
void pc_record_type::giveThing(short item_num) { short who_to,how_many = 0; item_record_type item_store; bool take_given_item = true; short pc_num = getNum(); if ((equip[item_num] == true) && (items[item_num].isCursed())) add_string_to_buf("Give: Item is cursed. "); else { item_store = items[item_num]; who_to = char_select_pc(1,1,"Give item to who?"); if ((overall_mode == MODE_COMBAT) && (adjacent(pc_pos[pc_num],pc_pos[who_to]) == false)) { add_string_to_buf("Give: Must be adjacent."); who_to = 6; } if ((who_to < 6) && (who_to != pc_num) && ((overall_mode != MODE_COMBAT) || (adjacent(pc_pos[pc_num],pc_pos[who_to]) == true))) { if ((item_store.type_flag > 0) && (item_store.charges > 1)) { how_many = get_num_of_items(item_store.charges); if (how_many == 0) return; if (how_many < item_store.charges) take_given_item = false; items[item_num].charges -= how_many; item_store.charges = how_many; } if (adven[who_to].giveToPC(item_store,0) == true) { if (take_given_item) takeItem(item_num); } else { if (adven[who_to].hasSpace() == 24) ASB("Can't give: PC has max. # of items."); else ASB("Can't give: PC carrying too much."); if (how_many > 0) items[item_num].charges += how_many; } } } }
m_num_t get_summon_monster(short summon_class) { short i,j; for (i = 0; i < 200; i++) { j = get_ran(1,0,255); if (scenario.scen_monsters[j].summon_type == summon_class) { return j; } } ASB(" Summon failed."); return 0; }
void adventure_notes() { unsigned short i; short item_hit; Str255 place_str; store_num_i = 0; //for (i = 0; i < 140; i++) //if (univ.party.special_notes_str[i][0] > 0) store_num_i = univ.party.special_notes.size(); //i + 1; store_page_on = 0; if (store_num_i == 0) { ASB("Nothing in your journal."); print_buf(); return; } make_cursor_sword(); cd_create_dialog_parent_num(961,0); for (i = 0; i < 3; i++) { if (univ.party.special_notes.size() > i) { switch (univ.party.special_notes[i].str_num / 1000) { case 0: strcpy((char *) place_str,scenario.scen_strs(univ.party.special_notes[i].str_num % 1000)); break; case 1: load_outdoor_str(loc(univ.party.special_notes[i].where % scenario.out_width, univ.party.special_notes[i].where / scenario.out_width), univ.party.special_notes[i].str_num % 1000,(char *)place_str); break; case 2: load_town_str(univ.party.special_notes[i].where,univ.party.special_notes[i].str_num % 1000,(char *)place_str); break; } csit(961,3 + i,(char *) place_str); cd_activate_item(961,9 + i,1); } else cd_activate_item(961,9 + i,0); } if (store_num_i <= 3) { cd_activate_item(961,7,0); cd_activate_item(961,8,0); } item_hit = cd_run_dialog(); cd_kill_dialog(961); }
void handle_talk_event(POINT p) { short i,j,force_special = 0,get_pc,s1 = -1,s2 = -1,s3 = -1; char asked[4]; char place_string1[256] = ""; char place_string2[256] = ""; short a,b,c,d,ttype,which_talk_entry = -1; p.x -= 5; p.y -= 5; if (PtInRect(&talk_help_rect,p)) { if (play_sounds == true) play_sound(37); party.help_received[5] = 0; give_help(205,6,0); return; } for (i = 0; i < 9; i++) if ((PtInRect(&preset_words[i].word_rect,p)) && ((talk_end_forced == false) || (i == 6) || (i == 5))) { click_talk_rect((char *) old_str1,(char *) old_str2,preset_words[i].word_rect); switch (i) { case 0: case 1: case 2: case 7: case 8: force_special = i + 1; break; case 3: case 4: force_special = i + 1; break; case 5: // save if (strnum1 <= 0) { MessageBeep(MB_OK); return; } for (j = 0; j < 120; j++) if ((party.talk_save[j].personality == store_personality) && (party.talk_save[j].str1 == strnum1) && (party.talk_save[j].str2 == strnum2)) { ASB("This is already saved."); print_buf(); return; } for (j = 0; j < 120; j++) if (party.talk_save[j].personality <= 0) { give_help(57,0,0); play_sound(0); party.talk_save[j].personality = store_personality; party.talk_save[j].town_num = (unsigned char) c_town.town_num; party.talk_save[j].str1 = strnum1; party.talk_save[j].str2 = strnum2; ASB("Noted in journal."); j = 200; } if (j < 200) { MessageBeep(MB_OK); ASB("No more room in talking journal."); } print_buf(); return; break; case 6: // quit end_talk_mode(); if(talk_end_forced == 10){ // party is in inn talk_end_forced = true; // safety set for(j=0; j < 700; j++){ party.age++; // Specials countdowns if ((party.age % 500 == 0) && (get_ran(1,0,5) == 3) && (adven.hasAbil(ITEM_DISEASE_PARTY) == true)) { j = 900; adven.disease(2); } // Plants and magic shops if (party.age % 4000 == 0) refresh_store_items(); timed_special_happened = special_increase_age(0);//don't delay the trigger of the special, if there's a special if(timed_special_happened && PSD[SDF_COMPATIBILITY_SPECIALS_INTERRUPT_REST] == 1){ j = 900; add_string_to_buf(" Rest interrupted."); print_buf(); } } } return; break; default: for (j = 0; j < 4; j++) asked[j] = preset_words[i].word[j]; break; } i = 100; } if (i < 100) { for (i = 0; i < 50; i++) if ((PtInRect(&store_words[i].word_rect,p)) && (talk_end_forced == false)) { click_talk_rect((char *) old_str1,(char *) old_str2,store_words[i].word_rect); for (j = 0; j < 4; j++) asked[j] = store_words[i].word[j]; i = 100; } } if(strcmp(talk_edit_string,"") != 0){ for(j = 0; j < 4; j++) asked[j] = talk_edit_string[j]; talk_edit_string[0] = '\0'; i = 100; } if (i == 50) // no event return; if (force_special == 9) { get_text_response(1017,place_string1,0); asked[0] = place_string1[0]; asked[1] = place_string1[1]; asked[2] = place_string1[2]; asked[3] = place_string1[3]; } if ((asked[0] == 'n') && (asked[1] == 'a') &&(asked[2] == 'm') &&(asked[3] == 'e')) { force_special = 2; } if ((asked[0] == 'l') && (asked[1] == 'o') &&(asked[2] == 'o') &&(asked[3] == 'k')) { force_special = 1; } if (((asked[0] == 'j') && (asked[1] == 'o') &&(asked[2] == 'b')) || ((asked[0] == 'w') && (asked[1] == 'o') &&(asked[2] == 'r')&&(asked[3] == 'k')) ) { force_special = 3; } if((asked[0] == 'b') && (asked[1] == 'u') && (asked[2] == 'y')) force_special = 4; if((asked[0] == 'b') && (asked[1] == 'y') && (asked[2] == 'e')){ end_talk_mode(); return; } if (force_special > 0) { switch (force_special) { case 1: case 2: case 3: GetIndString(place_string1,120 + ((store_personality - 1) / 10), ((store_personality - 1) % 10) * 3 + 10 + force_special); sprintf((char *) place_string1,"%s",data_store3->talk_strs[store_personality % 10 + 10 * force_special]); oldstrnum1 = strnum1; oldstrnum2 = strnum2; strnum1 = store_personality % 10 + 10 * force_special; strnum2 = 0; strcpy((char *) one_back1,(char *) old_str1); strcpy((char *) one_back2,(char *) old_str2); strcpy((char *) old_str1,(char *) place_string1); strcpy((char *) old_str2,(char *) place_string2); place_talk_str((char *) place_string1,(char *) place_string2,0,dummy_rect); return; break; case 4: // buy button asked[0] = 'p';asked[1] = 'u';asked[2] = 'r';asked[3] = 'c'; if (scan_for_response(asked) >= 0) break; asked[0] = 's';asked[1] = 'a';asked[2] = 'l';asked[3] = 'e'; if (scan_for_response(asked) >= 0) break; asked[0] = 'h';asked[1] = 'e';asked[2] = 'a';asked[3] = 'l'; if (scan_for_response(asked) >= 0) break; asked[0] = 'i';asked[1] = 'd';asked[2] = 'e';asked[3] = 'n'; if (scan_for_response(asked) >= 0) break; asked[0] = 't';asked[1] = 'r';asked[2] = 'a';asked[3] = 'i'; if (scan_for_response(asked) >= 0) break; break; case 5: // sell button asked[0] = 's';asked[1] = 'e';asked[2] = 'l';asked[3] = 'l'; if (scan_for_response(asked) >= 0) break; break; case 8: // back 1 strnum1 = oldstrnum1; strnum2 = oldstrnum2; strcpy((char *) place_string1,(char *) one_back1); strcpy((char *) place_string2,(char *) one_back2); strcpy((char *) one_back1,(char *) old_str1); strcpy((char *) one_back2,(char *) old_str2); strcpy((char *) old_str1,(char *) place_string1); strcpy((char *) old_str2,(char *) place_string2); place_talk_str((char *) place_string1,(char *) place_string2,0,dummy_rect); return; break; } } which_talk_entry = scan_for_response(asked); if ((which_talk_entry < 0) || (which_talk_entry > 59)) { strcpy((char *) one_back1,(char *) old_str1); strcpy((char *) one_back2,(char *) old_str2); sprintf((char *) old_str2,""); sprintf((char *) old_str1,"%s",data_store3->talk_strs[store_personality % 10 + 160]); if (strlen((char *) old_str1) < 2) sprintf((char *) old_str1,"You get no response."); place_talk_str((char *) old_str1,(char *) old_str2,0,dummy_rect); strnum1 = -1; return; } ttype = talking.talk_nodes[which_talk_entry].type; a = talking.talk_nodes[which_talk_entry].extras[0]; b = talking.talk_nodes[which_talk_entry].extras[1]; c = talking.talk_nodes[which_talk_entry].extras[2]; d = talking.talk_nodes[which_talk_entry].extras[3]; sprintf(place_string1,"%s",data_store3->talk_strs[40 + which_talk_entry * 2]); sprintf(place_string2,"%s",data_store3->talk_strs[40 + which_talk_entry * 2 + 1]); oldstrnum1 = strnum1; oldstrnum2 = strnum2; strnum1 = 40 + which_talk_entry * 2; strnum2 = 40 + which_talk_entry * 2 + 1; switch(ttype) { case TALK_REGULAR: break; case TALK_DEP_ON_SDF: if (PSD[a][b] > c) { strnum1 = strnum2; strcpy(place_string1, place_string2); } sprintf(place_string2,""); strnum2 = 0; break; case TALK_SET_SDF: PSD[a][b] = 1; break; case TALK_INN: if (party.gold < a) { strnum1 = strnum2; strcpy(place_string1, place_string2); } else { talk_end_forced = true; party.gold -= a; put_pc_screen(); if(PSD[SDF_COMPATIBILITY_CHECK_TIMERS_WHILE_RESTING] == 1){ talk_end_forced = 10; adven.heal(30 * b); adven.restoreSP(25 * b); c_town.p_loc.x = c; c_town.p_loc.y = d; center = c_town.p_loc; } else{ adven.heal(30 * b); adven.restoreSP(25 * b); party.age += 700; c_town.p_loc.x = c; c_town.p_loc.y = d; center = c_town.p_loc; } } strnum2 = 0; sprintf(place_string2,""); break; case TALK_DEP_ON_TIME: if (day_reached((unsigned char) a,0) == true) { strnum1 = strnum2; strcpy(place_string1, place_string2); } sprintf(place_string2,""); strnum2 = 0; break; case TALK_DEP_ON_TIME_AND_EVENT: if (day_reached((unsigned char) a,(unsigned char) b) == true) { strnum1 = strnum2; strcpy(place_string1, place_string2); } sprintf(place_string2,""); strnum2 = 0; break; case TALK_DEP_ON_TOWN: if (c_town.town_num != a) { strnum1 = strnum2; strcpy(place_string1, place_string2); } sprintf(place_string2,""); strnum2 = 0; break; case TALK_BUY_ITEMS: c = minmax(1,30,(int)c); start_shop_mode(SHOP_MISC_SHOP,b, b + c - 1,a, place_string1); strnum1 = -1; return; case TALK_TRAINING: if ((get_pc = char_select_pc(1,0,"Train who?")) < 6) { strnum1 = -1; spend_xp(get_pc,1, 0); } sprintf(place_string1, "You conclude your training."); put_pc_screen(); return; case TALK_BUY_MAGE: case TALK_BUY_PRIEST: case TALK_BUY_ALCHEMY: c = minmax(1,30,(int)c); start_shop_mode(ttype + 1,b, b + c - 1,a, place_string1); strnum1 = -1; return; case TALK_BUY_HEALING: //healer start_shop_mode(SHOP_HEALER,0,0,a, place_string1); strnum1 = -1; return; break; case TALK_SELL_WEAPONS: // sell weap strnum1 = -1; stat_screen_mode = 3; put_item_screen(stat_window,1); give_help(42,43,0); break; case TALK_SELL_ARMOR: // sell armor strnum1 = -1; stat_screen_mode = 4; put_item_screen(stat_window,1); give_help(42,43,0); break; case TALK_SELL_ITEMS: // sell misc strnum1 = -1; stat_screen_mode = 5; put_item_screen(stat_window,1); give_help(42,43,0); break; case TALK_IDENTIFY: case TALK_ENCHANT: // ident, enchant strnum1 = -1; stat_screen_mode = (ttype == 16) ? 2 : 6; shop_identify_cost = a; put_item_screen(stat_window,1); give_help(ttype - 16 + 44,0,0); break; case TALK_BUY_INFO: if (party.gold < a) { strnum1 = strnum2; strcpy(place_string1, place_string2); } else { party.gold -= a; put_pc_screen(); } sprintf(place_string2,""); strnum2 = 0; break; case TALK_BUY_SDF: if ((sd_legit(b,c) == true) && (PSD[b][c] == d)) { sprintf(place_string1, "You've already learned that."); strnum1 = -1; } else if (party.gold < a) { strnum1 = strnum2; strcpy(place_string1, place_string2); } else { party.gold -= a; put_pc_screen(); if (sd_legit(b,c) == true) PSD[b][c] = d; else give_error("Invalid Stuff Done flag called in conversation.","",0); } strnum2 = 0; sprintf(place_string2,""); break; case TALK_BUY_SHIP: if (party.gold < a) { strnum1 = strnum2; strnum2 = 0; strcpy(place_string1, place_string2); sprintf(place_string2,""); break; } else { for (i = b; i <= b + c; i++) if ((i >= 0) && (i < 30) && (party.boats[i].property == true)) { party.gold -= a; put_pc_screen(); party.boats[i].property = false; sprintf(place_string2,""); strnum2 = 0; i = 1000; } if (i >= 1000) break; } sprintf(place_string1, "There are no boats left."); sprintf(place_string2,""); strnum1 = -1; strnum2 = -1; break; case TALK_BUY_HORSE: if (party.gold < a) { strnum1 = strnum2; strnum2 = 0; strcpy(place_string1, place_string2); sprintf(place_string2,""); break; } else { for (i = b; i <= b + c; i++) if ((i >= 0) && (i < 30) && (party.horses[i].property == true)) { party.gold -= a; put_pc_screen(); party.horses[i].property = false; sprintf(place_string2,""); strnum2 = 0; i = 1000; } if (i >= 1000) break; } sprintf(place_string1, "There are no horses left."); sprintf(place_string2,""); strnum1 = -1; strnum2 = -1; break; case TALK_BUY_SPEC_ITEM: if (party.spec_items[a] > 0) { sprintf(place_string1, "You already have it."); strnum1 = -1; } else if (party.gold < b) { strcpy(place_string1, place_string2); strnum1 = strnum2; } else { party.gold -= b; put_pc_screen(); party.spec_items[a] = 1; } strnum2 = 0; sprintf(place_string2,""); break; case TALK_BUY_JUNK: start_shop_mode(SHOP_MAGIC_SHOP_1 + b,0, 9,a, place_string1); strnum1 = -1; return; case TALK_BUY_TOWN_LOC: if (party.can_find_town[b] > 0) { } else if (party.gold < a) { strnum1 = strnum2; strcpy(place_string1, place_string2); } else { party.gold -= a; put_pc_screen(); party.can_find_town[b] = 1; } strnum2 = 0; sprintf(place_string2,""); break; case TALK_END_FORCE: talk_end_forced = true; break; case TALK_END_FIGHT: c_town.monst.dudes[store_m_num].attitude = 1; c_town.monst.dudes[store_m_num].mobile = 1; talk_end_forced = true; break; case TALK_END_ALARM: set_town_status(0); talk_end_forced = true; break; case TALK_END_DIE: c_town.monst.dudes[store_m_num].active = 0; // Special killing effects if (sd_legit(c_town.monst.dudes[store_m_num].monst_start.spec1,c_town.monst.dudes[store_m_num].monst_start.spec2) == true) party.stuff_done[c_town.monst.dudes[store_m_num].monst_start.spec1][c_town.monst.dudes[store_m_num].monst_start.spec2] = 1; talk_end_forced = true; break; case TALK_CALL_TOWN_SPEC: // town special run_special(SPEC_TALK,2,a,c_town.p_loc,&s1,&s2,&s3); // check s1 & s2 to see if we got diff str, and, if so, munch old strs if ((s1 >= 0) || (s2 >= 0)) { strnum1 = -1; strnum2 = -1; sprintf(place_string1,""); sprintf(place_string2,""); } get_strs(place_string1, place_string2,2,s1,s2); if (s1 >= 0) strnum1 = 2000 + s1; if (s2 >= 0) strnum2 = 2000 + s2; put_pc_screen(); put_item_screen(stat_window,0); break; case TALK_CALL_SCEN_SPEC: // scen special run_special(SPEC_TALK,0,a,c_town.p_loc,&s1,&s2,&s3); // check s1 & s2 to see if we got diff str, and, if so, munch old strs if ((s1 >= 0) || (s2 >= 0)) { strnum1 = -1; strnum2 = -1; sprintf(place_string1,""); sprintf(place_string2,""); } get_strs(place_string1, place_string2,0,s1,s2); if (s1 >= 0) strnum1 = 3000 + s1; if (s2 >= 0) strnum2 = 3000 + s2; put_pc_screen(); put_item_screen(stat_window,0); break; } strcpy(one_back1, old_str1); strcpy(one_back2, old_str2); strcpy(old_str1, place_string1); strcpy(old_str2, place_string2); place_talk_str(old_str1, old_str2,0,dummy_rect); }
void handle_sale(short what_chosen,short cost) { item_record_type base_item; short what_magic_shop,what_magic_shop_item,i; RECT dummy_rect = {0,0,0,0}; switch (what_chosen / 100) { case 0: case 1: case 2: case 3: case 4: base_item = get_stored_item(what_chosen); base_item.item_properties = base_item.item_properties | 1; //cost = (base_item.charges == 0) ? base_item.value : base_item.value * base_item.charges; switch (adven[current_pc].okToBuy(cost,base_item)) { case 1: play_sound(-38); adven[current_pc].giveToPC(base_item,true); break; case 2: ASB("Can't carry any more items."); break; case 3: ASB("Not enough cash."); break; case 4: ASB("Item is too heavy."); break; case 5: ASB("You own too many of this."); break; } break; case 5: base_item = store_alchemy(what_chosen - 500); if (party.alchemy[base_item.item_level] == true) ASB("You already know that recipe."); else if (party.takeGold(cost, false) == false) ASB("Not enough gold."); else { play_sound(62); ASB("You buy an alchemical recipe."); party.alchemy[base_item.item_level] = true; } break; case 7: what_chosen -= 700; if (party.takeGold(cost, false) == false) ASB("Not enough gold."); else { ASB("You pay the healer."); play_sound(68); switch (what_chosen) { case 0: adven[current_pc].cur_health = adven[current_pc].max_health; break; case 1: adven[current_pc].status[STATUS_POISON] = 0; break; case 2: adven[current_pc].status[STATUS_DISEASE] = 0; break; case 3: adven[current_pc].status[STATUS_PARALYZED] = 0; break; case 4: for (i = 0; i < 24; i++) if ((adven[current_pc].equip[i] == true) && (adven[current_pc].items[i].isCursed())) adven[current_pc].items[i].item_properties = adven[current_pc].items[i].item_properties & 239; break; case 5: case 6: case 7: adven[current_pc].main_status = MAIN_STATUS_ALIVE; break; case 8: adven[current_pc].status[STATUS_DUMB] = 0; break; } } break; case 8: base_item = store_mage_spells(what_chosen - 800 - 30); if ((base_item.item_level < 0) || (base_item.item_level > 61)) { MessageBeep(MB_OK); ASB("Error 102: Report this!"); break;} if (adven[current_pc].mage_spells[base_item.item_level] == true) ASB("You already have this spell."); else if (party.takeGold(cost, false) == false) ASB("Not enough gold."); else { play_sound(62); ASB("You buy a spell."); adven[current_pc].mage_spells[base_item.item_level] = true; give_help(41,0,0); } break; case 9: base_item = store_priest_spells(what_chosen - 900 - 30); if ((base_item.item_level < 0) || (base_item.item_level > 61)) { MessageBeep(MB_OK); ASB("Error 101: Report this!"); break;} if (adven[current_pc].priest_spells[base_item.item_level] == true) ASB("You already have this spell."); else if (party.takeGold(cost, false) == false) ASB("Not enough gold."); else { play_sound(62); ASB("You buy a spell."); adven[current_pc].priest_spells[base_item.item_level] = true; give_help(41,0,0); } break; default: what_magic_shop = (what_chosen / 1000) - 1; what_magic_shop_item = what_chosen % 1000; base_item = party.magic_store_items[what_magic_shop][what_magic_shop_item]; base_item.item_properties = base_item.item_properties | 1; switch (adven[current_pc].okToBuy(cost,base_item)) { case 1: play_sound(-38); adven[current_pc].giveToPC(base_item,true); party.magic_store_items[what_magic_shop][what_magic_shop_item].variety = ITEM_TYPE_NO_ITEM; break; case 2: ASB("Can't carry any more items."); break; case 3: ASB("Not enough cash."); break; case 4: ASB("Item is too heavy."); break; } break; } set_up_shop_array(); if (overall_mode != MODE_SHOPPING) { MessageBeep(MB_OK); ASB("Shop error 1. Report This!"); } draw_shop_graphics(0,dummy_rect); print_buf(); put_pc_screen(); put_item_screen(stat_window,0); }
void handle_menu_choice(eMenu item_hit) { std::string dialogToShow; sf::Event dummyEvent = {sf::Event::KeyPressed}; short i, choice; switch(item_hit) { case eMenu::NONE: break; case eMenu::FILE_OPEN: do_load(); break; case eMenu::FILE_SAVE: do_save(0); break; case eMenu::FILE_SAVE_AS: do_save(1); break; case eMenu::FILE_NEW: if(overall_mode != MODE_STARTUP) { std::string choice = cChoiceDlog("restart-game",{"okay","cancel"}).show(); if(choice == "cancel") return; for(i = 0; i < 6; i++) univ.party[i].main_status = eMainStatus::ABSENT; party_in_memory = false; reload_startup(); overall_mode = MODE_STARTUP; draw_startup(0); } start_new_game(); draw_startup(0); menu_activate(); break; case eMenu::FILE_ABORT: if(overall_mode != MODE_STARTUP) { std::string choice = cChoiceDlog("abort-game",{"okay","cancel"}).show(); if (choice=="cancel") return; reload_startup(); overall_mode = MODE_STARTUP; } party_in_memory = false; draw_startup(0); menu_activate(); break; case eMenu::PREFS: pick_preferences(); break; case eMenu::QUIT: if(overall_mode == MODE_STARTUP) { if(party_in_memory) { std::string choice = cChoiceDlog("quit-confirm-save", {"save","quit","cancel"}).show(); if(choice == "cancel") break; if(choice == "save") { fs::path file = nav_put_party(); if(!file.empty()) break; save_party(file, univ); } } All_Done = true; break; } if(overall_mode > MODE_TOWN) { std::string choice = cChoiceDlog("quit-confirm-nosave",{"quit","cancel"}).show(); if(choice == "cancel") return; } else { std::string choice = cChoiceDlog("quit-confirm-save",{"quit","save","cancel"}).show(); if(choice == "cancel") break; if(choice == "save") { if(univ.file.empty()) { univ.file = nav_put_party(); if(univ.file.empty()) break; } save_party(univ.file, univ); } } All_Done = true; break; case eMenu::OPTIONS_PC_GRAPHIC: choice = char_select_pc(1,"New graphic for who?"); if(choice < 6) pick_pc_graphic(choice,1,nullptr); draw_terrain(); break; case eMenu::OPTIONS_DELETE_PC: if(!prime_time()) { ASB("Finish what you're doing first."); print_buf(); } else { choice = char_select_pc(1,"Delete who?"); if(choice < 6) { std::string confirm = cChoiceDlog("delete-pc-confirm",{"yes","no"}).show(); if(confirm == "yes") kill_pc(univ.party[choice],eMainStatus::ABSENT); } draw_terrain(); } break; case eMenu::OPTIONS_RENAME_PC: choice = char_select_pc(1,"Rename who?"); if(choice < 6) pick_pc_name(choice,nullptr); put_pc_screen(); put_item_screen(stat_window); break; case eMenu::OPTIONS_NEW_PC: if(!(is_town())) { add_string_to_buf("Add PC: Town mode only."); print_buf(); break; } for(i = 0; i < 6; i++) if(univ.party[i].main_status == eMainStatus::ABSENT) i = 20; if(i == 6) { ASB("Add PC: You already have 6 PCs."); print_buf(); break; } if(univ.town->has_tavern) { give_help(56,0); create_pc(6,nullptr); } else { add_string_to_buf("Add PC: You cannot add new characters in this town. Try in the town you started in.", 2); } print_buf(); put_pc_screen(); put_item_screen(stat_window); break; case eMenu::OPTIONS_JOURNAL: journal(); break; case eMenu::OPTIONS_TALK_NOTES: if(overall_mode == MODE_TALKING) { ASB("Talking notes: Can't read while talking."); print_buf(); return; } talk_notes(); break; case eMenu::OPTIONS_ENCOUNTER_NOTES: adventure_notes(); break; case eMenu::OPTIONS_STATS: if(overall_mode != MODE_STARTUP) print_party_stats(); break; case eMenu::HELP_OUT: dialogToShow = "help-outdoor"; break; case eMenu::HELP_TOWN: dialogToShow = "help-town"; break; case eMenu::HELP_COMBAT: dialogToShow = "help-combat"; break; case eMenu::HELP_BARRIER: dialogToShow = "help-fields"; break; case eMenu::HELP_HINTS: dialogToShow = "help-hints"; break; case eMenu::HELP_SPELLS: dialogToShow = "help-magic"; break; case eMenu::ABOUT: dialogToShow = "about-boe"; break; case eMenu::LIBRARY_MAGE: display_spells(eSkill::MAGE_SPELLS,100,0); break; case eMenu::LIBRARY_PRIEST: display_spells(eSkill::PRIEST_SPELLS,100,0); break; case eMenu::LIBRARY_SKILLS: display_skills(eSkill::INVALID,0); break; case eMenu::LIBRARY_ALCHEMY: // TODO: Create a dedicated dialog for alchemy info display_alchemy(); break; case eMenu::LIBRARY_TIPS: tip_of_day(); break; case eMenu::LIBRARY_INTRO: dialogToShow = "welcome"; break; case eMenu::ACTIONS_ALCHEMY: dummyEvent.key.code = sf::Keyboard::A; dummyEvent.key.shift = true; handle_keystroke(dummyEvent); break; case eMenu::ACTIONS_WAIT: dummyEvent.key.code = sf::Keyboard::W; handle_keystroke(dummyEvent); break; case eMenu::ACTIONS_AUTOMAP: if(!prime_time()) { ASB("Finish what you're doing first."); print_buf(); } else { give_help(62,0); display_map(); } make_cursor_sword(); break; case eMenu::HELP_TOC: if(fs::is_directory(progDir/"doc")) launchURL("file://" + (progDir/"doc/game/Contents.html").string()); else launchURL("https://blades.calref.net/doc/game/Contents.html"); break; case eMenu::ABOUT_MAGE: case eMenu::ABOUT_PRIEST: give_help(209,0); break; case eMenu::ABOUT_MONSTERS: give_help(212,0); break; } if(!dialogToShow.empty()) { cChoiceDlog dlog(dialogToShow); dlog.show(); } }
Boolean handle_menu (short item, HMENU) { short choice,i; POINT x = {1001,0},pass_point; Boolean to_return = false; switch (item) { case 1: // File Menu if (in_startup_mode == true) startup_load(); else do_load(); break; case 2: do_save(0); break; case 3: if (in_startup_mode == true) save_file(1); else do_save(1); break; case 4: if (in_startup_mode == false) { choice = FCD(1091,0); if (choice == 1) return false; for (i = 0; i < 6; i++) adven[i].main_status = MAIN_STATUS_ABSENT; party_in_memory = false; reload_startup(); in_startup_mode = true; draw_startup(0); } start_new_game(); draw_startup(0); break; case 6: pick_preferences(); break; case 7: pick_compatibility(); break; case 8: // Quit if (in_startup_mode == true) { to_return = All_Done = true; break; } if (overall_mode > MODE_TOWN) { choice = FCD(1067,0); if (choice == 1) return All_Done; } else { choice = FCD(1066,0); if (choice == 3) break; if (choice == 1) save_file(0); } to_return = All_Done = true; break; // Options menu case 21: choice = char_select_pc(0,0,"New graphic for who?"); if (choice < 6) pick_pc_graphic(choice,1,0); initiate_redraw(); break; case 22: choice = select_pc(0,0); if (choice < 6) pick_pc_name(choice,0); put_pc_screen(); put_item_screen(stat_window,0); break; case 23: if (!(is_town())) { add_string_to_buf("Add PC: Town mode only."); print_buf(); break; } for (i = 0; i < NUM_OF_PCS; i++) if (adven[i].main_status == MAIN_STATUS_ABSENT) i = 20; if (i == INVALID_PC) { ASB("Add PC: You already have 6 PCs."); print_buf(); } if (c_town.town_num == scenario.which_town_start) { give_help(56,0,0); create_pc(6,0); } else { add_string_to_buf("Add PC: You can only make new"); add_string_to_buf(" characters in the town you "); add_string_to_buf(" started in."); } print_buf(); put_pc_screen(); put_item_screen(stat_window,0); break; case 24: if (prime_time() == false) { ASB("Finish what you're doing first."); print_buf(); } else { choice = char_select_pc(0,0,"Delete who?"); if (choice < 6) { if ((i = FCD(1053,0)) == 2) adven[choice].kill(0); } initiate_redraw(); } break; case 27: if (overall_mode == MODE_TALKING) { ASB("Talking notes: Can't read while talking."); print_buf(); return to_return; } talk_notes(); break; case 28: adventure_notes(); break; case 29: if (in_startup_mode == false) print_party_stats(); break; // Help menu case 41: FCD(1079,0); break; case 42: FCD(1080,0); break; case 43: FCD(1081,0); break; case 44: FCD(1072,0); break; // magic barriers case 46: FCD(1084,0); break; case 47: FCD(1088,0); break; // Library case 61: display_spells(0,100,0); break; case 62: display_spells(1,100,0); break; case 63: display_skills(100,0); break; case 64: display_help(0,0); break; case 65: tip_of_day(); break; case 67: FCD(986,0); break; // Actions case 81: if (overall_mode != MODE_TOWN) { ASB("Alchemy: In town mode only."); print_buf(); break; } pass_point.x = 1000; pass_point.y = 405; to_return = handle_action(pass_point,(WPARAM) 0,(LPARAM)-1); break; case 82: to_return = handle_action(x,(WPARAM) 0,(LPARAM)-1); break; case 84: if (prime_time() == false) { ASB("Finish what you're doing first."); print_buf(); } else { give_help(62,0,0); display_map(); } SetCursor(sword_curs); break; // Mage is 399 case 399: give_help(209,0,0); party.help_received[9] = false; break; // Priest is 499 case 499: give_help(209,0,0); party.help_received[9] = false; break; // Monsters is 599 case 599: give_help(212,0,0); break; case 100: // Index WinHelp(mainPtr,"Blades of Exile.hlp",HELP_CONTENTS,0L); break; case 200: // About FCD(1062,0); break; default: if ((item >= 400) && (item < 500)) { // mage spell if (prime_time() == false) { ASB("Finish what you're doing first."); print_buf(); } else handle_menu_spell(item - 400,0); break; } if ((item >= 500) && (item < 600)) { // priest spell if (prime_time() == false) { ASB("Finish what you're doing first."); print_buf(); } else handle_menu_spell(item - 500,1); break; } if ((item >= 600) && (item < 700)) { // monster spell display_monst(item - 600,(creature_data_type *) NULL,1); break; } break; } if (in_startup_mode == true) menu_activate(0); else menu_activate(1); return to_return; }
void add_to_journal(short event) { if(univ.party.add_to_journal(event, calc_day())) ASB("Something was added to your journal."); }
void pc_record_type::giveXP(short amt) { short adjust,add_hp; short xp_percent[30] = {150,120,100,90,80,70,60,50,50,50, 45,40,40,40,40,35,30,25,23,20, 15,15,15,15,15,15,15,15,15,15}; if (!isAlive()) return; if (level > 49) { level = 50; return; } if (amt > 200) { // debug MessageBeep(MB_OK); ASB("Oops! Too much xp!"); ASB("Report this!"); return; } if (amt < 0) { // debug MessageBeep(MB_OK); ASB("Oops! Negative xp!"); ASB("Report this!"); return; } if (level >= 40) adjust = 15; else adjust = xp_percent[level / 2]; if ((amt > 0) && (level > 7)) { if (get_ran(1,0,100) < xp_percent[level / 2]) amt--; } if (amt <= 0) return; experience += (max(((amt * adjust) / 100), 0) * 100) / 100; party.total_xp_gained += (max(((amt * adjust) / 100), 0) * 100) / 100; if (experience < 0) { MessageBeep(MB_OK); ASB("Oops! Xp became negative somehow!"); ASB("Report this!"); experience = level * (get_tnl(this)) - 1; return; } if (experience > 15000) { experience = 15000; return; } while (experience >= (level * (get_tnl(this)))) { play_sound(7); level++; sprintf (c_line, " %s is level %d! ", name, level); add_string_to_buf(c_line); skill_pts += (level < 20) ? 5 : 4; add_hp = (level < 26) ? get_ran(1,2,6) + skill_bonus[skills[SKILL_STRENGTH]] : max (skill_bonus[skills[SKILL_STRENGTH]],0); if (add_hp < 0) add_hp = 0; max_health += add_hp; if (max_health > 250) max_health = 250; cur_health += add_hp; if (cur_health > 250) cur_health = 250; put_pc_screen(); } }