-+-+-+-+-+-+-+-+ START OF PART 13 -+-+-+-+-+-+-+-+ X`09for i1 := 1 to max_high_scores do X`09 list`5Bi1`5D := ''; X`09n1 := 1; X`09priv_switch(1); X`09trys := 0; X`09file_flag := false; X`09repeat X`09 open (f1,file_name:=moria_top, X`09`09organization:=sequential,history:=old, X`09`09sharing:=none,error:=continue); X`09 if (status(f1) = 2) then X`09 begin X`09 trys := trys + 1; X`09 if (trys > 5) then X`09`09file_flag := true X`09 else X`09`09sleep(2); X`09 end X`09 else X`09 file_flag := true; X`09until(file_flag); X`09if ((status(f1) <> 0) and (status(f1) <> 2)) then X`09 open (f1,file_name:=moria_top, X`09`09organization:=sequential,history:=new, X`09`09sharing:=none,error:=continue); X`09if (status(f1) <> 0) then X`09 begin X`09 writeln('Error in opening ',moria_top); X`09 writeln('Please contact local Moria Wizard.'); X`09 exit; X`09 end; X`09reset(f1); X`09while ((not eof(f1)) and (n1 <= max_high_scores)) do X`09 begin X`09 readln(f1,temp,error:=continue); X`09 seed := encrypt_seed1; X`09 decrypt(temp); X`09 list`5Bn1`5D := temp; X`09 n1 := n1 + 1; X`09 end; X`09n1 := n1 - 1; X`09i1 := 1; X`09i3 := total_points; X`09flag := false; X`09while ((i1 <= n1) and (not flag)) do X`09 begin X`09 readv(list`5Bi1`5D,blank,i4,error:=continue); X`09 if (i4 < i3) then X`09 flag := true X`09 else X`09 i1 := i1 + 1; X`09 end; X`09if ((i3 > 0) and ((flag) or (n1 = 0) or (n1 < max_high_scores))) then X`09 begin X`09 for i2 := max_high_scores-1 downto i1 do X`09 list`5Bi2+1`5D := list`5Bi2`5D; X`09 o1 := get_username; X`09 writev(list`5Bi1`5D,pad(o1,' ',13),i3:8,' ',py.misc.diffic:1,' ', X`09`09center(py.misc.name,24),' ',py.misc.lev:2,' ', X`09`09center(py.misc.race,10),' ',center(py.misc.tclass,16)); X`09 if (n1 < max_high_scores) then X`09 n1 := n1 + 1; X`09 max_score := n1; X`09 flag := false; X`09 end; X`09rewrite(f1); X`09for i1 := 1 to n1 do X`09 begin X`09 temp := list`5Bi1`5D; X`09 seed := encrypt_seed1; X`09 encrypt(temp); X`09 writeln(f1,temp); X`09 end; X`09close(f1); X`09priv_switch(0); X`09put_buffer('Username Points Diff Character name Level Race V Class',1,1); X`09put_buffer('____________ ________ _ ________________________ __ _________ V_ ________________',2,1); X`09i2 := 3; X`09if (max_score > n1) then max_score := n1; X`09for i1 := 1 to max_score do X`09 begin X`09 insert_str(list`5Bi1`5D,chr(7),''); X`09 put_buffer(list`5Bi1`5D,i2,1); X`09 if (i1 <> 1) and ((i1 mod 20) = 0) and (i1 <> max_score) then X`09 begin X`09`09prt('`5BPress any key to continue, or -Z to exit`5D', X`09`09`0924,1); X`09`09inkey(ch); X`09`09case ord(ch) of X`09`09 3,25,26 : begin X`09`09`09 erase_line(24,1); X`09`09`09 put_buffer(' ',23,13); X`09`09`09 exit; X`09`09`09 end; X`09`09 otherwise ; X`09`09end; X`09`09clear(3,1); X`09`09i2 := 2; X`09 end; X`09 i2 := i2 + 1; X`09 end; X`09erase_line(23,1); X`09put_qio; X end; X X X`09`7B Change the player into a King!`09`09`09-RAK-`09`7D X procedure kingly; X begin X`09`7B Change the character attributes...`09`09`7D X`09dun_level := 0; X`09died_from := 'Ripe Old Age'; X`09with py.misc do X`09 begin X`09 lev := lev + max_player_level; X`09 if ( characters_sex = male ) then X`09 begin X`09`09title := 'Magnificent'; X`09`09tclass := tclass + ' King'; X`09 end X`09 else X`09 begin X`09`09title := 'Beautiful'; X`09`09tclass := tclass + ' Queen'; X`09 end; X`09 account := account + 250000; X`09 max_exp := max_exp + 5000000; X`09 exp := max_exp; X`09 end; X`09`7B Let the player know that he did good...`09`7D X`09clear(1,1); X`09dprint(' #',2); X`09dprint(' #####',3); X`09dprint(' #',4); X`09dprint(' ,,, $$$ ,,,',5); X`09dprint(' ,,=$ "$$$$$" $=,,',6); X`09dprint(' ,$$ $$$ $$,',7); X`09dprint(' *> <*> <*',8); X`09dprint(' $$ $$$ $$',9); X`09dprint(' "$$ $$$ $$"',10); X`09dprint(' "$$ $$$ $$"',11); X`09dprint(' *#########*#########*',12); X`09dprint(' *#########*#########*',13); X`09dprint(' Veni, Vidi, Vici!',16); X`09dprint(' I came, I saw, I conquered!',17); X`09dprint(' All Hail the Mighty King!',18); X`09flush; X`09pause(24); X end; X X X`09`7B What happens upon dying...`09`09`09`09-RAK-`09`7D X begin X temp := py.misc.ssn; X seed := encrypt_seed1; X coder(temp); X temp_id := temp; X priv_switch(1); X open(f2,file_name:=moria_mas,access_method:=keyed, X organization:=indexed,history:=old,sharing:=readwrite,error:=continu Ve); X if (status(f2) <> 0) then X begin X`09msg_print('ERROR opening file MASTER. Contact your local wizard.'); X`09msg_print('Status = '+itos(status(f1))); X`09msg_print(' '); X end X else begin X findk(f2,0,temp_id,error:=continue); X delete(f2,error:=continue); X end; X close(f2,error:=continue); X priv_switch(0); X open(f1,file_name:=finam,record_length:=1024,history:=old, X`09`09disposition:=delete,error:=continue); X close(f1,error:=continue); X if (total_winner) then kingly; X print_tomb; X print_dead_character; X top_twenty; X exit; X end; X XEnd. $ CALL UNPACK DEATH.PAS;1 309136763 $ create 'f' X`5BInherit('Moria.Env')`5D Module Desc; X X`09`7B Object descriptor routines`09`09`09`09`09`7D X X`09`7B Randomize colors, woods, and metals`09`09`09`09`7D X`5Bglobal,psect(setup$code)`5D procedure randes; X var X`09i1,i2`09`09: integer; X`09tmp`09`09: vtype; X begin X for i1 := 1 to max_colors do X`09begin X`09 i2 := randint(max_colors); X`09 tmp := colors`5Bi1`5D; X`09 colors`5Bi1`5D := colors`5Bi2`5D; X`09 colors`5Bi2`5D := tmp; X`09end; X for i1 := 1 to max_woods do X`09begin X`09 i2 := randint(max_woods); X`09 tmp := woods`5Bi1`5D; X`09 woods`5Bi1`5D := woods`5Bi2`5D; X`09 woods`5Bi2`5D := tmp; X`09end; X for i1 := 1 to max_metals do X`09begin X`09 i2 := randint(max_metals); X`09 tmp := metals`5Bi1`5D; X`09 metals`5Bi1`5D := metals`5Bi2`5D; X`09 metals`5Bi2`5D := tmp; X`09end; X for i1 := 1 to max_horns do X`09begin X`09 i2 := randint(max_horns); X`09 tmp := horns`5Bi1`5D; X`09 horns`5Bi1`5D := horns`5Bi2`5D; X`09 horns`5Bi2`5D := tmp; X`09end; X for i1 := 1 to max_rocks do X`09begin X`09 i2 := randint(max_rocks); X`09 tmp := rocks`5Bi1`5D; X`09 rocks`5Bi1`5D := rocks`5Bi2`5D; X`09 rocks`5Bi2`5D := tmp; X`09end; X for i1 := 1 to max_amulets do X`09begin X`09 i2 := randint(max_amulets); X`09 tmp := amulets`5Bi1`5D; X`09 amulets`5Bi1`5D := amulets`5Bi2`5D; X`09 amulets`5Bi2`5D := tmp; X`09end; X for i1 := 1 to max_mush do X`09begin X`09 i2 := randint(max_mush); X`09 tmp := mushrooms`5Bi1`5D; X`09 mushrooms`5Bi1`5D := mushrooms`5Bi2`5D; X`09 mushrooms`5Bi2`5D := tmp; X`09end; X for i1 := 1 to max_cloths do X`09begin X`09 i2 := randint(max_cloths); X`09 tmp := cloths`5Bi1`5D; X`09 cloths`5Bi1`5D := cloths`5Bi2`5D; X`09 cloths`5Bi2`5D := tmp; X`09end; X end; X X X`09`7B Return random title`09`09`09`09`09`09`7D X`5Bglobal,psect(setup$code)`5D procedure rantitle(var title`09: varying`5Ba` V5D of char); X var X`09i1,i2,i3`09: integer; X begin X i3 := randint(2) + 1; X title := 'Titled "'; X for i1 := 1 to i3 do X`09begin X`09 for i2 := 1 to randint(2) do X`09 title := title + syllables`5Brandint(max_syllables)`5D; X`09 if (i1 <> i3) then title := title + ' '; X`09end; X title := title + '"'; X end; X X X`09`7B Initialize all Potions, wands, staves, scrolls, ect...`09`7D X`5Bglobal,psect(setup$code)`5D procedure magic_init(random_seed : unsigned); X var X`09i1,tmpv`09`09: integer; X`09tmps`09`09: vtype; X begin X seed := random_seed; X randes; X for i1 := 1 to max_objects do X`09begin X`09 tmpv := int(uand(%X'FF',object_list`5Bi1`5D.subval)); X`09 case object_list`5Bi1`5D.tval of X`09 potion1,potion2 : if (tmpv <= max_colors) then X`09`09 insert_str(object_list`5Bi1`5D.name,'%C',colors`5Btmpv`5D); X`09 scroll1,scroll2 : begin X`09`09 rantitle(tmps); X`09`09 insert_str(object_list`5Bi1`5D.name,'%T',tmps); X`09`09 end; X`09`09ring : if (tmpv <= max_rocks) then X`09`09 insert_str(object_list`5Bi1`5D.name,'%R',rocks`5Btmpv`5D); X`09`09valuable_gems : if (tmpv <= max_rocks) then X`09`09`09insert_str(object_list`5Bi1`5D.name,'%R',rocks`5Btmpv`5D); X`09`09valuable_gems_wear : if (tmpv <= max_rocks) then X`09`09`09insert_str(object_list`5Bi1`5D.name,'%R',rocks`5Btmpv`5D); X`09`09amulet : if (tmpv <= max_amulets) then X`09`09 insert_str(object_list`5Bi1`5D.name,'%A',amulets`5Btmpv`5D); X`09`09wand : if (tmpv <= max_metals) then X`09`09 insert_str(object_list`5Bi1`5D.name,'%M',metals`5Btmpv`5D); X`09`09chime : if (tmpv <= max_metals) then X`09`09`09insert_str(object_list`5Bi1`5D.name,'%M',metals`5Btmpv`5D); X`09`09horn : if (tmpv <= max_horns) then X`09`09 insert_str(object_list`5Bi1`5D.name,'%H',horns`5Btmpv`5D); X`09`09staff : if (tmpv <= max_woods) then X`09`09 insert_str(object_list`5Bi1`5D.name,'%W',woods`5Btmpv`5D); X`09 food : if (tmpv <= max_mush) then X`09`09 insert_str(object_list`5Bi1`5D.name,'%M',mushrooms`5Btmpv`5D); X`09`09rod : `7Bif (tmpv <= max_rods) then X`09`09 insert_str(object_list`5Bi1`5D.name,'%D',rods`5Btmpv`5D)`7D; X`09`09bag_or_sack : if (tmpv <= max_cloths) then X`09`09 insert_str(object_list`5Bi1`5D.name,'%N',cloths`5Btmpv`5D); X`09`09misc_usable : begin X`09`09`09if (tmpv <= max_rocks) then X`09 `09`09insert_str(object_list`5Bi1`5D.name,'%R',rocks`5Btmpv`5D); X`09`09`09if (tmpv <= max_woods) then X`09 `09`09insert_str(object_list`5Bi1`5D.name,'%W',woods`5Btmpv`5D); X`09`09`09if (tmpv <= max_metals) then X`09 `09`09insert_str(object_list`5Bi1`5D.name,'%M',metals`5Btmpv`5D); X`09`09`09if (tmpv <= max_amulets) then X`09 `09`09insert_str(object_list`5Bi1`5D.name,'%A',amulets`5Btmpv`5D); X`09`09`09end; X`09`09`09 X`09`09otherwise ; X`09 end X`09end X end; X X X`09`7B Remove 'Secret' symbol for identity of object`09`09`09`7D X`5Bglobal,psect(misc1$code)`5D procedure known1(var object_str : varying`5Ba V`5D of char); X var X`09pos,olen`09: integer; X`09str1,str2`09: vtype; X begin X pos := index(object_str,'`7C'); X if (pos > 0) then X`09begin X`09 olen := length(object_str); X`09 str1 := substr(object_str,1,pos-1); X`09 str2 := substr(object_str,pos+1,olen-pos); X`09 writev(object_str,str1,str2); X`09end; X end; X X X`09`7B Remove 'Secret' symbol for identity of pluses`09`09`09`7D X`5Bglobal,psect(misc1$code)`5D procedure known2(var object_str : varying`5Ba V`5D of char); X var X`09pos,olen`09: integer; X`09str1,str2`09: vtype; X begin X pos := index(object_str,'`5E'); X if (pos > 0) then X`09begin X`09 olen := length(object_str); X`09 str1 := substr(object_str,1,pos-1); X`09 str2 := substr(object_str,pos+1,olen-pos); X`09 writev(object_str,str1,str2); X`09end; X end; X X X`09`7B Return string without quoted portion`09`09`09`09`7D X`5Bglobal,psect(misc1$code)`5D procedure unquote(var object_str : varying`5B Va`5D of char); X var X`09pos0,pos1,pos2,olen`09: integer; X`09str1,str2`09`09: vtype; X begin X pos0 := index(object_str,'"'); X if (pos0 > 0) then X`09begin X`09 pos1 := index(object_str,'`7E'); X`09 pos2 := index(object_str,'`7C'); X`09 olen := length(object_str); X`09 str1 := substr(object_str,1,pos1); X`09 str2 := substr(object_str,pos2+1,olen-pos2); X`09 writev(object_str,str1,str2); X`09end X end; X`09 `20 X X X`09`7B Somethings been identified`09`09`09`09`09`7D X`5Bglobal,psect(misc1$code)`5D procedure identify(item : treasure_type); X var X`09i1,x1,x2`09`09: integer; X`09curse`09`09`09: treas_ptr; X begin X x1 := item.tval; X x2 := item.subval; X if (index(item.name,'`7C') > 0) then X`09begin X for i1 := 1 to max_talloc do X`09 with t_list`5Bi1`5D do X`09 if ((tval = x1) and (subval = x2)) then X`09 begin X`09 unquote(name); X`09 known1(name); X`09 end; X for i1 := 1 to equip_max do X`09 with equipment`5Bi1`5D do X`09 if ((tval = x1) and (subval = x2)) then X`09 begin X`09 unquote(name); X`09 known1(name); X`09 end; X i1 := 0; X`09 curse := inventory_list; X`09 while (curse <> nil) do X`09 begin X`09 with curse`5E.data do X`09`09if ((tval = x1) and (subval = x2)) then X`09`09 begin X`09`09 unquote(name); X`09`09 known1(name); X`09`09 end; X`09 curse := curse`5E.next; X`09 end; X repeat X`09 i1 := i1 + 1; X`09 with object_list`5Bi1`5D do X`09 if ((tval = x1) and (subval = x2)) then X`09 if (index(name,'%T') > 0) then X`09`09 begin X`09 insert_str(name,' %T`7C',''); X`09`09 object_ident`5Bi1`5D := true; X`09`09 end X`09`09else X`09`09 begin X`09 unquote(name); X`09 known1(name); X`09 object_ident`5Bi1`5D := true; X`09 end; X until (i1 = max_objects); X`09end; X end; X X X`09`7B Returns a description of item for inventory`09`09`09`7D X`5Bglobal,psect(misc1$code)`5D procedure objdes( X`09`09var out_val `09: varying`5Ba`5D of char; X`09`09 ptr `09: treas_ptr; X`09`09 pref `09: boolean); X var X`09pos`09`09: integer; X`09tmp_val`09`09: vtype; X begin X with ptr`5E.data do X`09begin X`09 tmp_val := name; X`09 pos := index(tmp_val,'`7C'); X`09 if (pos > 0) then X`09 tmp_val := substr(tmp_val,1,pos-1); X`09 pos := index(tmp_val,'`5E'); X`09 if (pos > 0) then X`09 tmp_val := substr(tmp_val,1,pos-1); X`09 if (not(pref)) then X`09 begin X`09 pos := index(tmp_val,' ('); +-+-+-+-+-+-+-+- END OF PART 13 +-+-+-+-+-+-+-+-