-+-+-+-+-+-+-+-+ START OF PART 38 -+-+-+-+-+-+-+-+ X`09`09`09`09py_bonuses(equipment`5Bequipment_helm`5D,1); X`09`09`09 end X`09`09`09 else X`09`09`09 begin X`09`09`09`09msg_print('There is no more room on the helm.'); X`09`09`09`09if (randint(2) = 1) then X`09`09`09`09 begin X`09`09`09`09 msg_print('You lose your grip and the gem falls to the floor V.'); X`09`09`09`09 msg_print('The gem shatters!'); X`09`09`09`09 inven_destroy(item_ptr); X`09`09`09`09 end X`09`09`09`09else X`09`09`09`09 msg_print('You catch the gem in mid air'); X`09`09`09 end; X`09`09`09 end X`09`09 else X`09`09`09msg_print('I don''t see how you can use that.'); X`09`09 test_flag := false; X`09`09 com_val := 0; X`09`09 end; X`09`09 otherwise X`09`09`09 begin X`09`09`09 msg_print('I don''t see how you can use that.'); X`09`09`09 test_flag := false; X`09`09`09 com_val := 0; X`09`09`09 end; X`09`09end; X`09`09if (test_flag) then X`09`09 if (equipment`5Bi1`5D.tval > 0) then X`09`09 begin X`09`09 if (uand(cursed_worn_bit,equipment`5Bi1`5D.flags) <> 0) then X`09`09`09begin X`09`09`09 inven_temp`5E.data := equipment`5Bi1`5D; X`09`09`09 objdes(out_val,inven_temp,false); X`09`09`09 out_val := 'The ' + out_val + ' you are '; X`09`09`09 case i1 of X`09`09`09 Equipment_primary : out_val := out_val + 'wielding '; X`09`09`09 otherwise out_val := out_val + 'wearing '; X`09`09`09 end; X`09`09`09 msg_print(out_val + 'appears to be cursed.'); X`09`09`09 test_flag := false; X`09`09`09 com_val := 0; X`09`09`09end; X`09`09 end; X`09`09if (test_flag) then X`09`09 begin X`09`09 unwear_obj := equipment`5Bi1`5D; X`09`09 equipment`5Bi1`5D := item_ptr`5E.data; X`09`09 with equipment`5Bi1`5D do X`09`09 begin X`09`09`09`09`7B Fix for torches `7D X`09`09`09if ((subval > 255) and (subval < 512)) then X`09`09`09 begin X`09`09`09 number := 1; X`09`09`09 subval := subval - 255; X`09`09`09 end; X`09`09`09`09`7B Fix for weight `7D X`09`09`09inven_weight := inven_weight + weight*number; X`09`09 end; X`09`09 inven_destroy(item_ptr); `7B Subtracts weight `7D X`09`09 equip_ctr := equip_ctr + 1; X`09`09 py_bonuses(equipment`5Bi1`5D,1); X`09`09 if (unwear_obj.tval > 0) then X`09`09 begin X`09`09`09equipment`5Bequip_max`5D := unwear_obj; X`09`09`09remove(equip_max); X`09`09 end; X`09`09 case i1 of X`09`09 Equipment_primary : prt1 := 'You are wielding '; X`09`09 Equipment_light`09: prt1 := 'Your light source is '; X`09`09 otherwise `09 prt1 := 'You are wearing '; X`09`09 end; X`09`09 inven_temp`5E.data := equipment`5Bi1`5D; X`09`09 objdes(prt2,inven_temp,true); X`09`09 i2 := 0; X`09`09 i3 := equipment_min-1; X`09`09 repeat `7B Get the right letter of equipment `7D X`09`09 i3 := i3 + 1; X`09`09 if (equipment`5Bi3`5D.tval > 0) then X`09`09`09i2 := i2 + 1; X`09`09 until (i3 = i1); X`09`09 out_val := prt1 + prt2 + ' (' + chr(i2+96)+cur_char2; X`09`09 msg_print(out_val); X`09`09 end; X`09 end; X`09 if (scr_state = 0) then X`09 exit_flag := true X`09 else if (inven_ctr = 0) then X`09 exit_flag := true X`09 until(exit_flag); X`09 if (scr_state <> 0) then prt('You are currently carrying -',1,1); X`09end; X X`09`7B Statistics routine, get wizard info on an item`09-DMF-`09`7D X procedure stats; X`09var X`09 com_val,i1,i2,i3,tmp : integer; X`09 out_val,prt1,prt2 : vtype; X`09 item_ptr`09`09`09`09: treas_ptr; X`09 exit_flag,test_flag : boolean; X`09 trash`09`09`09`09`09: char; X`09 line`09`09`09`09`09: integer; X`09begin X`09 exit_flag := false; X`09 repeat X`09 writev(prompt,'(Items a-%N, space for next page, `5EZ to exit) ', X`09`09`09 'Statistics on which one ?'); X`09 clear(1,1); X`09 item_ptr := nil; X`09 change_all_ok_stats(true,true); X`09 clear_display; X`09 exit_flag := not show_inven(item_ptr,true,false); X`09 if (item_ptr <> nil) then X`09 begin X`09`09test_flag := true; X`09`09clear(1,1); X`09`09prt('Name : ',1,1); X`09`09prt('Description : ',2,1); X`09`09prt('Value : ',3,1); X`09`09prt('Type : ',4,1); X`09`09prt('Character : ',5,1); X`09`09prt('Flags : ',6,1); X`09`09prt('Flags2 : ',7,1); X`09`09prt('P1 : ',8,1); X`09`09prt('Cost : ',9,1); X`09`09prt('Subval : ',10,1); X`09`09prt('Weight : ',11,1); X`09`09prt('Number : ',12,1); X`09`09prt('+ To hit : ',13,1); X`09`09prt('+ To Damage : ',14,1); X`09`09prt('AC : ',15,1); X`09`09prt('+ To AC : ',16,1); X`09`09prt('Damage : ',17,1); X`09`09prt('Level : ',18,1); X`09`09prt('Insured : ',19,1); X`09`09prt(item_ptr`5E.data.name,1,15); X`09`09objdes(out_val,item_ptr,true); X`09`09prt(out_val,2,15); X`09`09writev(out_val,item_ptr`5E.data.tval:1); X`09`09prt(out_val,3,15); X`09`09case item_ptr`5E.data.tval of X`09`09 miscellaneous_object`09: out_val := 'Miscellaneous object'; X`09`09 chest`09`09`09: out_val := 'Chest'; X`09`09 misc_usable`09`09: out_val := 'Miscellaneous usable'; X`09`09 valuable_jewelry`09: out_val := 'Jewelry'; X`09`09 valuable_gems`09`09: out_val := 'Gem'; X`09`09 bag_or_sack`09`09: out_val := 'Bag or Sack'; X`09`09 valuable_gems_wear`09: out_val := 'Wearable Gem'; X`09`09 sling_ammo`09`09: out_val := 'Sling ammo'; X`09`09 bolt`09`09`09: out_val := 'Bolt'; X`09`09 arrow`09`09`09: out_val := 'Arrow'; X`09`09 spike`09`09`09: out_val := 'Spike'; X`09`09 Lamp_or_Torch`09`09: out_val := 'Lamp or torch'; X`09`09 bow_crossbow_or_sling : out_val := 'Ranged weapon'; X`09`09 hafted_weapon`09`09: out_val := 'Hafted weapon'; X`09`09 pole_arm`09`09: out_val := 'Pole arm'; X`09`09 sword`09`09`09: out_val := 'Sword'; X`09`09 dagger`09`09: out_val := 'Light Weapon'; X`09`09 maul`09`09`09: out_val := 'Blunt Weapon'; X`09`09 pick_or_shovel`09: out_val := 'Pick or shovel'; X`09`09 gem_helm`09`09: out_val := 'Gem Helm'; X`09`09 boots`09`09`09: out_val := 'Boots'; X`09`09 gloves_and_gauntlets`09: out_val := 'Gloves or gauntlets'; X`09`09 Cloak`09`09`09: out_val := 'Cloak'; X`09`09 helm`09`09`09: out_val := 'Helm'; X`09`09 shield`09`09: out_val := 'Shield'; X`09`09 hard_armor`09`09: out_val := 'Hard armor'; X`09`09 soft_armor`09`09: out_val := 'Soft armor'; X`09`09 bracers`09`09: out_val := 'Bracers'; X`09`09 belt`09`09`09: out_val := 'Belt'; X`09`09 amulet`09`09: out_val := 'Amulet'; X`09`09 ring`09`09`09: out_val := 'Ring'; X`09`09 staff`09`09`09: out_val := 'Staff'; X`09`09 rod`09`09`09: out_val := 'Rod'; X`09`09 wand`09`09`09: out_val := 'Wand'; X`09`09 scroll1,scroll2`09: out_val := 'Scroll'; X`09`09 potion1,potion2`09: out_val := 'Potion'; X`09`09 flask_of_oil`09`09: out_val := 'Flask of oil'; X`09`09 food`09`09`09: out_val := 'Food'; X`09`09 junk_food`09`09: out_val := 'Junk Food'; X`09`09 chime`09`09`09: out_val := 'Chime'; X`09`09 horn`09`09`09: out_val := 'Horn'; X`09`09 magic_book`09`09: out_val := 'Magic book'; X`09`09 prayer_book`09`09: out_val := 'Prayer book'; X`09`09 instrument`09`09: out_val := 'Instrument'; X`09`09 song_book`09`09: out_val := 'Song book'; X`09`09 otherwise`09`09 out_val := 'Unknown item type'; X`09`09end; X`09`09prt(out_val,4,15); X`09`09prt(item_ptr`5E.data.tchar,5,15); X`09`09print_hex_value(int(item_ptr`5E.data.flags),6,15); X`09`09print_hex_value(int(item_ptr`5E.data.flags2),7,15); X`09`09writev(out_val,item_ptr`5E.data.p1:1); X`09`09prt(out_val,8,15); X`09`09writev(out_val,item_ptr`5E.data.cost:1); X`09`09prt(out_val,9,15); X`09`09writev(out_val,item_ptr`5E.data.subval:1); X`09`09prt(out_val,10,15); X`09`09if (item_ptr`5E.data.weight < 100) then X`09`09 writev(out_val,item_ptr`5E.data.weight:1,' small') X`09`09else X`09`09 writev(out_val,(item_ptr`5E.data.weight div 100):1,' large'); X`09`09prt(out_val,11,15); X`09`09writev(out_val,item_ptr`5E.data.number:1); X`09`09prt(out_val,12,15); X`09`09writev(out_val,item_ptr`5E.data.tohit:1); X`09`09prt(out_val,13,15); X`09`09writev(out_val,item_ptr`5E.data.todam:1); X`09`09prt(out_val,14,15); X`09`09writev(out_val,item_ptr`5E.data.ac:1); X`09`09prt(out_val,15,15); X`09`09writev(out_val,item_ptr`5E.data.toac:1); X`09`09prt(out_val,16,15); X`09`09prt(item_ptr`5E.data.damage,17,15); X`09`09writev(out_val,item_ptr`5E.data.level:1); X`09`09prt(out_val,18,15); X`09`09writev(out_val,(uand(item_ptr`5E.data.flags2,insured_bit) <> 0):1); X`09`09prt(out_val,19,15); X`09`09prt('Hit any key to continue',21,29); X`09`09inkey(trash); X`09 end; X`09 until(exit_flag); X`09end; X X`09`7B Show players money`09`09`09`09-DMF-`09`7D X procedure show_money; X`09var X`09 prt1`09: vtype; X`09begin X`09 clear(1,1); X`09 with py.misc do X`09 begin X`09 prt('You are carrying -',1,1); X`09 writev(prt1,'Mithril : ',money`5Bmithril`5D:10); X`09 prt(prt1,3,10); X`09 writev(prt1,'Platinum : ',money`5Bplatinum`5D:10); X`09 prt(prt1,4,10); X`09 writev(prt1,'Gold : ',money`5Bgold`5D:10); X`09 prt(prt1,5,10); X`09 writev(prt1,'Silver : ',money`5Bsilver`5D:10); X`09 prt(prt1,6,10); X`09 writev(prt1,'Copper : ',money`5Bcopper`5D:10); X`09 prt(prt1,7,10); X`09 writev(prt1,'Iron : ',money`5Biron`5D:10); X`09 prt(prt1,8,10); X`09 writev(prt1,'Total : ',money`5Btotal$`5D:10); X`09 prt(prt1,10,10); X`09 end; X`09end; X X`09`7B Put an item inside of another item`09`09-DMF-`09`7D X procedure put_inside; X`09var X`09`09put_ptr,into_ptr,temp_ptr`09: treas_ptr; X`09`09curse`09`09`09`09: treas_ptr; X`09`09count,wgt`09`09`09: integer; X`09`09redraw,blooey`09`09`09: boolean; X`09procedure destroy_bag(bag : treas_ptr); X`09 begin X`09 while (bag`5E.next <> nil) and (bag`5E.next`5E.is_in) do X`09 begin X`09`09inven_weight := inven_weight - bag`5E.next`5E.data.number * X`09`09`09`09`09 bag`5E.next`5E.data.weight; X`09 delete_inven_item(bag`5E.next); X`09 end; X`09 inven_weight := inven_weight - bag`5E.data.number * bag`5E.data.weigh Vt; X`09 delete_inven_item(bag); X`09 end; X`09begin X`09 blooey := false; X`09 change_all_ok_stats(true,true); X`09 if (get_item(put_ptr,'Put which item?',redraw,inven_ctr,trash_char, X`09`09`09`09false,true)) then X`09 begin X`09 change_all_ok_stats(false,false); X`09 temp_ptr := inventory_list; X`09 count := 0; X`09 while (temp_ptr <> nil) do X`09`09begin X`09`09 if (uand(temp_ptr`5E.data.flags2,holding_bit) <> 0) then X`09`09 begin X`09`09 temp_ptr`5E.ok := true; X`09`09 count := count + 1; X`09`09 end; X`09`09 temp_ptr := temp_ptr`5E.next; X`09`09end; X`09 if (count = 0) then X`09`09msg_print('You have nothing to put it into.') X`09 else X`09`09begin X`09`09 clear(2,1); X`09`09 if (get_item(into_ptr,'Into which item?',redraw,inven_ctr, X`09`09`09`09trash_char,false,true)) then X`09`09 begin X`09`09 if (into_ptr = put_ptr) then X`09`09 msg_print('You can''t seem to fit it inside itself.') X`09`09 else if (uand(put_ptr`5E.data.flags2,holding_bit) <> 0) then X`09`09`09begin X`09`09`09 msg_print('Uh oh, now you''ve done it!'); X`09`09`09 msg_print('You lose the items in both bags!'); X`09`09`09 destroy_bag(put_ptr); X`09`09`09 destroy_bag(into_ptr); X`09`09`09end X`09`09 else X`09`09 begin X`09`09`09 py.flags.paralysis := py.flags.paralysis + 1; X`09`09`09 reset_flag := false; X`09`09`09 if (put_ptr = inventory_list) then X`09`09`09 begin X`09`09`09 temp_ptr := inventory_list; X`09`09`09 inventory_list := put_ptr`5E.next; X`09`09`09 end X`09`09`09 else X`09`09`09 begin X`09`09`09 curse := inventory_list; X`09`09`09 while (curse`5E.next <> put_ptr) do X`09`09`09`09curse := curse`5E.next; X`09`09`09 temp_ptr := put_ptr; X`09`09`09 curse`5E.next := put_ptr`5E.next; X`09`09`09 end; X`09`09`09 curse := inventory_list; X`09`09`09 while (curse <> into_ptr) do X`09`09`09 curse := curse`5E.next; X`09`09`09 put_ptr`5E.next := curse`5E.next; X`09`09`09 curse`5E.next := put_ptr; X`09`09`09 put_ptr`5E.is_in := true; X`09`09`09 into_ptr`5E.insides := into_ptr`5E.insides + 1; X`09`09`09 inven_weight := inven_weight - put_ptr`5E.data.weight * X`09`09`09`09`09`09`09 put_ptr`5E.data.number; X`09`09 msg_print('You stuff it inside'); X`09`09`09 if (uand(put_ptr`5E.data.flags2,sharp_bit) <> 0) then X`09`09`09 begin X`09`09`09 msg_print('You poke a hole in the bag!'); X`09`09`09 blooey := true; X`09`09`09 end; X`09`09`09 temp_ptr := into_ptr`5E.next; X`09`09`09 wgt := 0; X`09`09`09 while ((temp_ptr <> nil) and (temp_ptr`5E.is_in)) do X`09`09`09 begin X`09`09`09 wgt := wgt + temp_ptr`5E.data.weight * X`09`09`09`09`09 temp_ptr`5E.data.number; X`09`09`09 temp_ptr := temp_ptr`5E.next; X`09`09`09 end; X`09`09`09 if (wgt > into_ptr`5E.data.p1) then X`09`09`09 begin X`09`09`09 msg_print('The sides of the bag swell and burst!'); X`09`09`09 blooey := true; X`09`09`09 end; X`09`09`09 if (blooey) then destroy_bag(into_ptr); X`09`09 end X`09`09 end; X`09`09end; X`09 end; X`09 cur_inven := inventory_list; X`09end; X X`09`7B Take an item out of another item`09`09-DMF-`09`7D X procedure take_out; X`09var X`09`09from_ptr,temp_ptr,curse`09`09: treas_ptr; X`09`09count`09`09`09`09: integer; X`09`09redraw,flag`09`09`09: boolean; X`09`09old_ctr`09`09`09`09: integer; X`09begin X`09 count := change_all_ok_stats(false,true); X`09 if (count > 0) then X`09 if (get_item(from_ptr,'Remove which item?',redraw,count,trash_char,fals Ve,true)) then X`09 begin X`09 py.flags.paralysis := py.flags.paralysis + 2; X`09 reset_flag := false; X`09 temp_ptr := inventory_list; X`09 while (temp_ptr <> nil) and (temp_ptr <> from_ptr) do X`09`09begin X`09`09 if (uand(temp_ptr`5E.data.flags2,holding_bit) <> 0) then X`09`09 curse := temp_ptr; X`09`09 temp_ptr := temp_ptr`5E.next; X`09`09end; X`09 if (uand(curse`5E.data.flags2,swallowing_bit) <> 0) then X`09`09flag := (randint(100) < 6) X`09 else X`09`09flag := true; X`09 if (flag) then X`09`09begin X`09 curse`5E.insides := curse`5E.insides - 1; X`09 curse := inventory_list; X`09 while (curse`5E.next <> from_ptr) do X`09`09 curse := curse`5E.next; +-+-+-+-+-+-+-+- END OF PART 38 +-+-+-+-+-+-+-+-