home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / vmsnet / monhl10b / delta4 < prev    next >
Encoding:
Internet Message Format  |  1992-08-02  |  42.6 KB

  1. Path: uunet!mcsun!news.funet.fi!hydra!klaava!hurtta
  2. From: Kari.Hurtta@Helsinki.FI (Kari. E. Hurtta)
  3. Newsgroups: vmsnet.sources.games
  4. Subject: Monster Helsinki, Delta from 1.04 to 1.05 - part 4/7
  5. Message-ID: <1992Jun30.211312.12906@klaava.Helsinki.FI>
  6. Date: 30 Jun 92 21:13:12 GMT
  7. Sender: hurtta@klaava.Helsinki.FI (Kari Hurtta)
  8. Followup-To: vmsnet.sources.d
  9. Organization: University of Helsinki
  10. Lines: 1438
  11.  
  12. Archive-name: monster_helsinki_104_to_105/delta4
  13. Environment: VMS, Pascal
  14. Author: Kari.Hurtta@Helsinki.FI
  15.  
  16. -+-+-+-+-+-+-+-+ START OF PART 4 -+-+-+-+-+-+-+-+
  17. X                       delete_program(code);
  18. X                       delete_general(I_HEADER,code);
  19. X
  20. X`009`009       getspell_name;
  21. X`009`009       spell_name.idents`091sid`093 := '';
  22. X`009`009       putspell_name;
  23. X`009`009       getint(N_SPELL);
  24. X`009`009       anint.int`091sid`093 := 0;
  25. X`009`009       putint;
  26. X
  27. X`009`009       delete_general(I_SPELL,sid);
  28. X                       done := true;
  29. X                       code := 0;
  30. X                       writeln ('Spell deleted.');
  31. X                    end;
  32. X`009`009'i': begin
  33. X                       if param > '' then s := param
  34. X                       else begin
  35. X`009`009`009    writeln('Seting your level of this spell.');
  36. X`009`009`009    grab_line('Level? ',s,eof_handler := leave);
  37. X`009`009       end;
  38. X`009`009`009
  39. X`009`009       if isnum(s) then begin
  40. X`009`009`009  if number(s) < 0 then writeln('Must be positive or zero.')
  41. X`009`009`009  else begin
  42. X`009`009`009    getspell(mylog);
  43. X`009`009`009    spell.level`091sid`093 := number(s);
  44. X`009`009`009    putspell;
  45. X`009`009`009    writeln('Database modified');
  46. X`009`009`009end;
  47. X`009`009       end else writeln('Invalid number.');
  48. X`009`009`009`032
  49. X`009`009     end;
  50. X           'a'`009  : if get_flag(code, CF_SPELL_MODE) then`032
  51. X`009`009`009set_flag(code, CF_SPELL_MODE,FALSE)
  52. X`009`009    else if not spell_priv then`032
  53. X`009`009`009writeln('You haven''t power for this.')
  54. X`009`009    else set_flag(code, CF_SPELL_MODE,TRUE);
  55. X           otherwise writeln ('Enter ? for help.');
  56. X       end; `123 case `125
  57. X       until done;
  58. X       log_event (myslot,E_SPELLDONE,0,0,'');
  59. X     end;
  60. X  end;
  61. X  exit_label:
  62. Xend;
  63. X
  64. X`123 Global Code -----------------------------------------------------------
  65. V---- `125
  66. X
  67. X`091global`093 procedure exec_global(flag: integer; label_name: shortstring;
  68. V`032
  69. X`009force_read: boolean := false; variable: shortstring := '';
  70. X`009value: mega_string := '');
  71. Xvar code: integer;
  72. Xbegin
  73. X    if Gf_Types `091 flag`093 <> G_code then begin
  74. X`009writeln('%Error in exec_global:');
  75. X        writeln('%Global value #',flag:1,' isn''t global MDL code');
  76. X`009writeln('%Notify Monster Manager.');
  77. X`009code := 0;
  78. X    end else begin
  79. X`009if read_global or force_read then begin
  80. X`009    getglobal;
  81. X`009    freeglobal;
  82. X`009    read_global := false;
  83. X`009end;
  84. X`009code := global.int`091flag`093;
  85. X    end;
  86. X
  87. X    if code <> 0 then`032
  88. X`009run_monster(monster_name := '',
  89. X`009`009    code := code,
  90. X`009`009    label_name := label_name,
  91. X`009`009    variable := variable,
  92. X`009`009    value := value,
  93. X`009`009    time := sysdate + ' ' + systime);
  94. X
  95. Xend; `123 exec_global `125
  96. X
  97. XPROCEDURE custom_g_code(var code: integer);
  98. Xlabel exit_label;
  99. X
  100. Xvar done: boolean;
  101. X    param: string;
  102. X    default,s: string;
  103. X- 3039, 3039
  104. X`009goto exit_label;
  105. X- 3043, 3574
  106. X    if code = 0 then begin
  107. X`009if alloc_general(I_HEADER,code) then begin
  108. X`009    create_program (code,system_id,sysdate+' '+systime);
  109. X
  110. X`009    writeln ('New global MDL code created.');
  111. X`009`009       `009`009
  112. X`009end else begin
  113. X`009    writeln ('There is no place for any more codes in this universe.');
  114. X`009    code := 0;
  115. X`009end;
  116. X    end;
  117. X
  118. X    if code > 0 then begin
  119. X       default := 'GLOBAL_CODE';
  120. X
  121. X       done := false;
  122. X       repeat
  123. X        grab_line ('Custom global code> ',s,eof_handler := leave);
  124. X- 3578, 3582
  125. X           'h','?': command_help('*global c help*');
  126. X           'b'    : set_runnable(code,false);
  127. X           'c'    : type_paper;
  128. X- 3610, 3612
  129. X
  130. X                       code := 0;
  131. X                       writeln ('Code deleted.');
  132. X`009`009       done := true;
  133. X- 3616, 3884
  134. X/
  135. $ CALL UNPACK CUSTOM.DIF;1 225898837
  136. $ create/nolog 'f'
  137. X-   26
  138. X    26.6.1992 `124         `124 monster_owner, set_owner, delete_program mov
  139. Ved from INTERPRETER.PAS
  140. X              `124         `124 write_debug moved from PARSER.PAS
  141. X              `124         `124 system_view moved from MON.PAS
  142. X- 1376
  143. X`091global`093
  144. Xprocedure write_debug(a: string; b: mega_string := '');
  145. Xbegin
  146. X   if debug then begin
  147. X      write(a,'   ');
  148. X      if length(b) > 200 then`009`123 system limit printable string `125
  149. X                                `123 about 200 characters          `125
  150. X         writeln('(PARAMETER TOO LONG FOR PRINTING)')
  151. X      else writeln(b);
  152. X   end;
  153. Xend;
  154. X
  155. X`091global`093`032
  156. Xfunction monster_owner  (code: integer; class : integer := 0): shortstring;
  157. Xbegin `032
  158. X  write_debug ('%monster_owner');
  159. X  getheader(code);
  160. X  freeheader;
  161. X  case class of
  162. X    0: monster_owner := header.owner;
  163. X    1: monster_owner := header.author;
  164. X  end; `123 case `125
  165. Xend; `123 monster_owner `125
  166. X
  167. X`091global`093`032
  168. Xprocedure set_owner (code: integer; class : integer := 0; owner: shortstring
  169. V);
  170. Xbegin `032
  171. X  write_debug ('%set_owner');
  172. X  getheader(code);
  173. X  case class of
  174. X    0: header.owner := owner;
  175. X    1: header.author := owner;
  176. X  end; `123 case `125
  177. X  putheader
  178. Xend; `123 set_owner `125
  179. X
  180. X`091global`093                                `032
  181. Xprocedure delete_program (code: integer);
  182. Xlabel 1; `032
  183. Xvar fl: text;
  184. X    count,apu,errorcode: integer;
  185. Xbegin
  186. X  write_debug ('%delete_program');
  187. X  apu := code;
  188. X  count := 0;
  189. X  repeat
  190. X    open (fl,file_name(code),old,sharing:=NONE,error := continue,
  191. X          record_length := mega_length +20);
  192. X    errorcode := status(fl);
  193. X    if errorcode > 0 then begin
  194. X       count := count +1;
  195. X       write_debug ('%collision in delete_program');`032
  196. X       if count > 10 then  begin
  197. X          if debug then begin
  198. X`009     writeln ('%Deadlock in delete_program.');
  199. X`009     writeln ('% Error code (status): ',errorcode:1);
  200. X`009  end;
  201. X          goto 1
  202. X       end;
  203. X       wait (0.2);      `123 collision is very rare in here `125
  204. X    end
  205. X  until errorcode <= 0;
  206. X  reset (fl);
  207. X  truncate(fl);
  208. X  close(fl);
  209. X1:
  210. Xend; `123 delete_program `125
  211. X
  212. X`091global`093
  213. Xprocedure system_view;
  214. Xvar
  215. X`009used,free,total: integer;
  216. X
  217. Xbegin
  218. X`009writeln;
  219. X`009getindex(I_BLOCK);
  220. X`009freeindex;
  221. X`009used := indx.inuse;
  222. X`009total := indx.top;
  223. X`009free := total - used;
  224. X
  225. X`009writeln('               used   free   total');
  226. X`009writeln('Block file   ',used:5,'  ',free:5,'   ',total:5);
  227. X
  228. X`009getindex(I_LINE);
  229. X`009freeindex;
  230. X`009used := indx.inuse;
  231. X`009total := indx.top;
  232. X`009free := total - used;
  233. X`009writeln('Line file    ',used:5,'  ',free:5,'   ',total:5);
  234. X
  235. X`009getindex(I_ROOM);
  236. X`009freeindex;
  237. X`009used := indx.inuse;
  238. X`009total := indx.top;
  239. X`009free := total - used;
  240. X`009writeln('Room file    ',used:5,'  ',free:5,'   ',total:5);
  241. X
  242. X`009getindex(I_OBJECT);
  243. X`009freeindex;
  244. X`009used := indx.inuse;
  245. X`009total := indx.top;
  246. X`009free := total - used;
  247. X`009writeln('Object file  ',used:5,'  ',free:5,'   ',total:5);
  248. X
  249. X`009getindex(I_INT);
  250. X`009freeindex;
  251. X`009used := indx.inuse;
  252. X`009total := indx.top;
  253. X`009free := total - used;
  254. X`009writeln('Integer file ',used:5,'  ',free:5,'   ',total:5);
  255. X
  256. X`009getindex(I_HEADER);
  257. X`009freeindex;
  258. X`009used := indx.inuse;
  259. X`009total := indx.top;
  260. X`009free := total - used;
  261. X`009writeln('Header file  ',used:5,'  ',free:5,'   ',total:5);
  262. X
  263. X`009getindex(I_SPELL);
  264. X`009freeindex;
  265. X`009used := indx.inuse;
  266. X`009total := indx.top;
  267. X`009free := total - used;
  268. X`009writeln('Spells       ',used:5,'  ',free:5,'   ',total:5);
  269. X
  270. X`009getindex(I_PLAYER);
  271. X`009freeindex;
  272. X`009used := indx.inuse;
  273. X`009total := indx.top;
  274. X`009free := total - used;
  275. X`009writeln('Players      ',used:5,'  ',free:5,'   ',total:5);
  276. X
  277. X`009writeln;             `032
  278. Xend; `123 system_view `125
  279. X
  280. X`091 global `093
  281. Xprocedure fix_view_global_flags;
  282. Xbegin
  283. X    writeln('Global flags and values:');
  284. X    writeln;
  285. X    writeln('Monster active: ',view_global_value(GF_ACTIVE,TRUE));
  286. X    writeln('Database valid: ',view_global_value(GF_VALID));
  287. X    writeln('Wartime:        ',view_global_value(GF_WARTIME));
  288. X    writeln('Welcome text:   ',view_global_value(GF_STARTGAME));
  289. X    writeln('NewPlayer text: ',view_global_value(GF_NEWPLAYER));
  290. X    writeln('Global Hook:    ',view_global_value(GF_CODE));
  291. Xend;
  292. X
  293. X/
  294. $ CALL UNPACK DATABASE.DIF;1 274356766
  295. $ create/nolog 'f'
  296. X/
  297. $ CALL UNPACK DOG.DIF;1 47
  298. $ create/nolog 'f'
  299. X/
  300. $ CALL UNPACK FIX.DIF;1 47
  301. $ create/nolog 'f'
  302. X-  744
  303. X        VERSION : `091external`093 string;  `123 defined in VERSION.PAS `125
  304. X`009DISTRIBUTED : `091external`093 string;
  305. X`009`009`009`009`009    `123 defined in VERSION.PAS `125
  306. X
  307. X/
  308. $ CALL UNPACK GLOBAL.DIF;1 152775039
  309. $ create/nolog 'f'
  310. X/
  311. $ CALL UNPACK GREAT_HALL.DIF;1 47
  312. $ create/nolog 'f'
  313. X/
  314. $ CALL UNPACK GUTS.DIF;1 47
  315. $ create/nolog 'f'
  316. X/
  317. $ CALL UNPACK ILMOITUS.DIF;1 47
  318. $ create/nolog 'f'
  319. X/
  320. $ CALL UNPACK INIT.DIF;1 47
  321. $ create/nolog 'f'
  322. X-   30
  323. X   26.6.1992  `124         `124 monster_owner, set_owner, delete_program mov
  324. Ved to DATABASE.PAS
  325. X   29.6.1992  `124         `124 MDL-funktio or sallii nyt enemmin kuin 3 par
  326. Vametria
  327. X              `124         `124 MDL-funktio and parametrien m`228`228r`228 v
  328. Voi nyt vaihdella
  329. X-  209,  210
  330. X`009('and',`009`0092,  max_param),`009    `123 11 `125
  331. X`009('or',`009`0091,  max_param),`009    `123 12 `125
  332. X- 1902, 1903
  333. X         write_debug('%e_exclude - p1: ',a1);
  334. X         write_debug('%          - p2: ',a2);
  335. X- 1913, 1916
  336. X      function e_and (params: paramtable): string_t;
  337. X      var result: string_t;
  338. X`009  filter: string_t;
  339. X
  340. X`009function action_first(atom: atom_t): atom_t;
  341. X`009begin
  342. X`009    if not list_include(result,atom) then add_atom(result,atom);
  343. X`009    action_first := ''
  344. X`009end;
  345. X
  346. X`009function action_next(atom: atom_t): atom_t;
  347. X`009begin
  348. X`009    action_next := atom;
  349. X`009    if not list_include(result,atom) or
  350. X`009       list_include (filter,atom) then action_next := ''
  351. X`009    else add_atom(filter,atom);
  352. X`009end;
  353. X
  354. X      var i,n: integer;
  355. X- 1920, 1930
  356. X`009 n := count_params(params);
  357. X`009 meta_do(params`0911`093,action_first);
  358. X`009 write_debug('%e_and >> ',result);
  359. X         for i := 2 to n do begin
  360. X`009    filter := '';
  361. X`009    result := meta_do(params`091i`093,action_next);
  362. X`009    write_debug('%e_and >> ',result);
  363. X         end;
  364. X- 1935, 1936
  365. X      function e_or (params: paramtable): string_t;
  366. X      var result: string_t;              `032
  367. X- 1943
  368. X      var i,n: integer;
  369. X- 1947, 1952
  370. X`009n := count_params(params);
  371. X`009for i := 1 to n do meta_do(params`091i`093,action);`032
  372. X        write_debug('%e_or result: ',result);
  373. X        e_or := result
  374. X      end; `123 e_or `125
  375. X- 3144, 3145
  376. X`009    11: `123 and `125 result`009:= e_and (params);
  377. X`009    12: `123 or `125`009result := e_or (params);
  378. X- 3404, 3415
  379. X`123 monster_owner moved TO DATABASE.PAS `125
  380. X
  381. X- 3422, 3433
  382. X`123 set_owner moved to DATABASE.PAS `125
  383. X- 3887, 3917
  384. X`123 delete_program moved to DATABASE.PAS `125
  385. X- 3968, 3969
  386. Xend. `123 end of module interpreter `125
  387. V                                     `032
  388. X/
  389. $ CALL UNPACK INTERPRETER.DIF;1 3317373190
  390. $ create/nolog 'f'
  391. X/
  392. $ CALL UNPACK KEYS.DIF;1 47
  393. $ create/nolog 'f'
  394. X! Korjattu 6.5.1992 ?
  395. X! 17.6.1992 $(LINK), $(COMPILE), + ja ALL
  396. X! 25.6.1992 ALLOC.PAS
  397. X! 30.6.1992 VERSION.PAS, MONSTER_E.HLB
  398. X
  399. XLINK = LINK
  400. XCOMPILE = PASCAL /CHECK=ALL
  401. X
  402. XALL : MON.EXE, MONSTER_WHO.EXE, MONSTER_DUMP.EXE, MONSTER_REBUILD.EXE,-
  403. XMONSTER_E.HLB
  404. X`009$ WRITE SYS$OUTPUT "Done"
  405. XMONSTER_E.HLB : MONSTER_E.HLP
  406. X`009$ LIBRARIAN/CREATE/HELP MONSTER_E MONSTER_E
  407. XMON.EXE : MON.OBJ,GUTS.OBJ,INTERPRETER.OBJ,KEYS.OBJ,PRIVUSERS.OBJ,QUEUE.OBJ,
  408. V-
  409. XPARSER.OBJ,CLI.OBJ,GLOBAL.OBJ,DATABASE.OBJ,CUSTOM.OBJ,ALLOC.OBJ,VERSION.OBJ
  410. X`009$(LINK) MON,GUTS,INTERPRETER,KEYS,PRIVUSERS,QUEUE,PARSER,CLI,GLOBAL,-
  411. XDATABASE,CUSTOM,ALLOC,VERSION`009! Linkkaus
  412. XMONSTER_WHO.EXE : MONSTER_WHO.OBJ, DATABASE.OBJ, GUTS.OBJ, GLOBAL.OBJ,-
  413. XPRIVUSERS.OBJ, PARSER.OBJ, KEYS.OBJ
  414. X`009$(LINK) MONSTER_WHO, DATABASE, GUTS, GLOBAL, PRIVUSERS, PARSER
  415. XMONSTER_DUMP.EXE : MONSTER_DUMP.OBJ, DATABASE.OBJ, GUTS.OBJ, GLOBAL.OBJ,-
  416. XPRIVUSERS.OBJ, PARSER.OBJ, VERSION.OBJ
  417. X`009$(LINK) MONSTER_DUMP, DATABASE, GUTS, GLOBAL, PRIVUSERS, PARSER, -
  418. X`009VERSION
  419. XMONSTER_REBUILD.EXE : MONSTER_REBUILD.OBJ, DATABASE.OBJ, GUTS.OBJ, GLOBAL.OB
  420. VJ,-
  421. XPRIVUSERS.OBJ, PARSER.OBJ, ALLOC.OBJ, KEYS.OBJ, VERSION.OBJ
  422. X`009$(LINK) MONSTER_REBUILD, DATABASE, GUTS, GLOBAL, PRIVUSERS, PARSER, -
  423. X`009ALLOC, KEYS, VERSION
  424. XMONSTER_WHO.OBJ : MONSTER_WHO.PAS, DATABASE.PEN, GUTS.PEN, GLOBAL.PEN, -
  425. XPRIVUSERS.PEN, PARSER.PEN
  426. X`009$(COMPILE) MONSTER_WHO
  427. XMONSTER_DUMP.OBJ : MONSTER_DUMP.PAS, DATABASE.PEN, GUTS.PEN, GLOBAL.PEN, -
  428. XPRIVUSERS.PEN, PARSER.PEN
  429. X`009$(COMPILE) MONSTER_DUMP
  430. XMONSTER_REBUILD.OBJ : MONSTER_REBUILD.PAS, DATABASE.PEN, GUTS.PEN, GLOBAL.PE
  431. VN, -
  432. XPRIVUSERS.PEN, PARSER.PEN, ALLOC.PEN
  433. X`009$(COMPILE) MONSTER_REBUILD
  434. XGLOBAL.OBJ + GLOBAL.PEN : GLOBAL.PAS
  435. X`009$(COMPILE) GLOBAL`009`009! Globaalit m`228`228ritykset
  436. XDATABASE.OBJ + DATABASE.PEN : DATABASE.PAS,GLOBAL.PEN,GUTS.PEN
  437. X`009$(COMPILE) DATABASE`009`009! Tietokannan k`228sittely
  438. XMON.OBJ : MON.PAS,GLOBAL.PEN,DATABASE.PEN,GUTS.PEN,CLI.PEN, -
  439. X`009PRIVUSERS.PEN,PARSER.PEN,INTERPRETER.PEN, QUEUE.PEN, CUSTOM.PEN -
  440. X`009ALLOC.PEN
  441. X`009$(COMPILE) MON`009`009`009! MON.PASin k`228`228nn`246s
  442. XGUTS.OBJ + GUTS.PEN : GUTS.PAS,GLOBAL.PEN
  443. X`009$(COMPILE) GUTS`009`009`009! GUTS.PASin k`228`228nn`246s
  444. XINTERPRETER.OBJ + INTERPRETER.PEN : INTERPRETER.PAS,GLOBAL.PEN, -
  445. XDATABASE.PEN,PARSER.PEN
  446. X`009$(COMPILE) INTERPRETER `009`009! INTERPRETER.PASin k`228`228nn`246s
  447. XKEYS.OBJ + KEYS.PEN : KEYS.PAS,GLOBAL.PEN
  448. X`009$(COMPILE)  KEYS`009`009! Koodaustaulun k`228`228nn`246s
  449. XPRIVUSERS.OBJ + PRIVUSERS.PEN : PRIVUSERS.PAS,GLOBAL.PEN
  450. X`009$(COMPILE)  PRIVUSERS
  451. XQUEUE.OBJ + QUEUE.PEN : QUEUE.PAS,GLOBAL.PEN
  452. X`009$(COMPILE) QUEUE `009`009! QUEUE.PASin k`228`228nn`246s
  453. XPARSER.OBJ + PARSER.PEN : PARSER.PAS,GLOBAL.PEN,DATABASE.PEN
  454. X`009$(COMPILE) PARSER `009`009! PARSER.PASin k`228`228nn`246s
  455. XCLI.OBJ + CLI.PEN : CLI.PAS,GLOBAL.PEN,DATABASE.PEN
  456. X`009$(COMPILE) CLI
  457. XCUSTOM.OBJ + CUSTOM.PEN : CUSTOM.PAS, GLOBAL.PEN,DATABASE.PEN,GUTS.PEN, -
  458. X`009CLI.PEN, ALLOC.PEN, PRIVUSERS.PEN,PARSER.PEN,INTERPRETER.PEN, QUEUE.PEN
  459. X`009$(COMPILE) CUSTOM`009`009! CUSTOM.PASin k`228`228nn`246s
  460. XALLOC.OBJ + ALLOC.PEN : ALLOC.PAS, DATABASE.PEN, GUTS.PEN, GLOBAL.PEN, -
  461. X`009PRIVUSERS.PEN, PARSER.PEN
  462. X`009$(COMPILE) ALLOC`009`009! ALLOC.PASin k`228`228nn`246s
  463. XVERSION.OBJ : VERSION.PAS, GLOBAL.PEN
  464. X`009$(COMPILE) VERSION`009`009! Monsterin versionumero
  465. X.LAST :
  466. X`009show process/accounting
  467. X
  468. $ CALL UNPACK MAKEFILE.;61 2643067633
  469. $ create/nolog 'f'
  470. X-    2,    2
  471. X          'Alloc','Custom','Queue','Interpreter')`093
  472. X-   40
  473. X    25.6.1992 `124         `124  nc_createroom: part of finction createroom
  474. V to
  475. X              `124         `124  module ALLOC, REBUILD moved to MONSTER_REBU
  476. VILD.PAS
  477. X              `124         `124  system_view, fix_view_global_flags moved to
  478. V DATABASE.PAS
  479. X              `124         `124  FIX moved to MONSTER_REBUILD.PAS
  480. X- 2723, 2813
  481. X`009end else if nc_createroom(s) then begin
  482. X`009`009`123 nc_createroom have in module ALLOC `125
  483. X`009`009log_action(form,0);
  484. X`009`009writeln('Room created.');
  485. X- 2937, 3001
  486. X`123 system_view moved to DATABASE.PAS `125
  487. X
  488. X
  489. X`123 remove a user from the log records (does not handle ownership) `125
  490. X
  491. Xprocedure kill_user(s:string);
  492. Xvar
  493. X`009n: integer;
  494. X
  495. Xbegin
  496. X`009if length(s) = 0 then
  497. X`009`009writeln('No user specified')
  498. X`009else begin
  499. X`009`009if lookup_user(n,s,true) then begin
  500. X`009`009`009getindex(I_ASLEEP);
  501. X`009`009`009freeindex;               `032
  502. X                        `123 variable user is reading in lookup_user `125
  503. X                        if user.idents`091n`093`0911`093 = ':' then begin
  504. X `009`009`009`009writeln ('That is monster, not player.');
  505. X`009`009`009`009writeln ('Use ERASE <monster name> to delete monster.')
  506. X`009`009`009end else if indx.free`091n`093 then begin
  507. X`009`009`009`009delete_log(n);
  508. X`009`009`009`009writeln('Player deleted.');
  509. X`009  `009`009end else
  510. X`009`009`009`009writeln('That person is playing now.');
  511. X`009`009end else
  512. X`009`009`009writeln('No such userid found in log information.');
  513. X`009end;
  514. X- 3005, 3032
  515. X- 3903, 4363
  516. X
  517. X`123 REBUILD moved to MONSTER_REBUILD.PAS `125
  518. X
  519. X`123 FIX moved to MONSTER_REBUILD.PAS `125
  520. X
  521. X`123 put an object in this location
  522. X  if returns false, there were no more free object slots here:
  523. X  in other words, the room is too cluttered, and cannot hold any
  524. X  more objects
  525. X`125
  526. Xfunction place_obj(n: integer;silent:boolean := false): boolean;
  527. Xvar
  528. X`009found: boolean;
  529. X`009i: integer;
  530. Xbegin
  531. X`009if here.objdrop = 0 then getroom
  532. X`009else getroom(here.objdrop);
  533. X`009i := 1;
  534. X`009found := false;
  535. X`009while (i <= maxobjs) and (not found) do begin
  536. X`009`009if here.objs`091i`093 = 0 then found := true
  537. X`009`009else i := i + 1;
  538. X`009end;
  539. X`009place_obj := found;
  540. X`009if found then begin
  541. X`009`009here.objs`091i`093 := n;
  542. X`009`009here.objhide`091i`093 := 0;
  543. X`009`009putroom;
  544. X
  545. X`009`009gethere;
  546. X
  547. X
  548. X`009`009`123 if it bounced somewhere else then tell them `125
  549. X
  550. X`009`009if (here.objdrop <> 0) and (here.objdest <> 0) then
  551. X`009`009`009log_event(0,E_BOUNCEDIN,here.objdest,n,'',here.objdrop);
  552. X
  553. X
  554. X`009`009if not(silent) then begin
  555. X`009`009`009if here.objdesc <> 0 then
  556. X`009`009`009`009print_subs(here.objdesc,obj_part(n))
  557. X`009`009`009else
  558. X`009`009`009`009writeln('Dropped ',obj_part(n),'.');
  559. X`009`009end;
  560. X`009end else
  561. X`009`009freeroom;
  562. Xend;
  563. X
  564. X
  565. X`123 remove an object from this room `125
  566. Xfunction take_obj(objnum,slot: integer): boolean;
  567. Xbegin
  568. X`009getroom;
  569. X`009if here.objs`091slot`093 = objnum then begin
  570. X`009`009here.objs`091slot`093 := 0;
  571. X`009`009here.objhide`091slot`093 := 0;
  572. X`009`009take_obj := true;
  573. X`009end else
  574. X`009`009take_obj := false;
  575. X`009putroom;
  576. Xend;
  577. X
  578. X
  579. Xfunction can_hold: boolean;
  580. X
  581. Xbegin
  582. X`009if find_numhold < maxhold then
  583. X`009`009can_hold := true
  584. X`009else
  585. X`009`009can_hold := false;
  586. Xend;
  587. X
  588. X
  589. Xfunction can_drop: boolean;
  590. X
  591. Xbegin
  592. X`009if find_numobjs < maxobjs then
  593. X`009`009can_drop := true
  594. X`009else
  595. X`009`009can_drop := false;
  596. Xend;
  597. X
  598. X
  599. Xfunction find_hold(objnum: integer;slot:integer := 0): integer;
  600. Xvar
  601. X`009i: integer;
  602. X
  603. Xbegin
  604. X`009if slot = 0 then
  605. X`009`009slot := myslot;
  606. X`009i := 1;
  607. X`009find_hold := 0;
  608. X`009while i <= maxhold do begin
  609. X`009`009if here.people`091slot`093.holding`091i`093 = objnum then
  610. X`009`009`009find_hold := i;
  611. X`009`009i := i + 1;
  612. X`009end;
  613. Xend;
  614. X
  615. X
  616. X
  617. X`123 put object number n into the player's inventory; returns false if
  618. X  he's holding too many things to carry another `125
  619. X
  620. Xfunction hold_obj(n: integer): boolean;
  621. Xvar
  622. X`009found: boolean;
  623. X`009i: integer;
  624. X
  625. Xbegin
  626. X`009getroom;
  627. X`009i := 1;
  628. X`009found := false;
  629. X`009while (i <= maxhold) and (not found) do begin
  630. X`009`009if here.people`091myslot`093.holding`091i`093 = 0 then
  631. X`009`009`009found := true
  632. X`009`009else
  633. X`009`009`009i := i + 1;
  634. X`009end;
  635. X`009hold_obj := found;
  636. X`009if found then begin
  637. X`009`009here.people`091myslot`093.holding`091i`093 := n;
  638. X`009`009putroom;
  639. X
  640. X`009`009getobj(n);
  641. X`009`009freeobj;
  642. X`009`009hold_kind`091i`093 := obj.kind;
  643. X`009end else
  644. X`009`009freeroom;
  645. Xend;
  646. X
  647. X
  648. X
  649. X`123 remove an object (hold) from the player record, given the slot that
  650. X  the object is being held in `125
  651. X
  652. Xprocedure drop_obj(slot: integer;pslot: integer := 0);
  653. X
  654. Xbegin
  655. X`009if pslot = 0 then
  656. X`009`009pslot := myslot;
  657. X`009getroom;
  658. X`009here.people`091pslot`093.holding`091slot`093 := 0;
  659. X`009putroom;
  660. X
  661. X`009hold_kind`091slot`093 := 0;
  662. Xend;
  663. X
  664. X
  665. X
  666. X`123 maybe drop something I'm holding if I'm hit `125
  667. X
  668. Xprocedure maybe_drop;
  669. Xvar
  670. X`009i: integer;
  671. X`009objnum: integer;
  672. X`009s: string;
  673. X
  674. Xbegin
  675. X`009i := 1 + (rnd100 mod maxhold);
  676. X`009objnum := here.people`091myslot`093.holding`091i`093;
  677. X
  678. X`009if (objnum <> 0) and (mywield <> objnum) and (mywear <> objnum) then beg
  679. Vin
  680. X`009`009`123 drop something `125
  681. X
  682. X`009`009drop_obj(i);
  683. X`009`009if place_obj(objnum,TRUE) then begin
  684. X`009`009    getobj(objnum);
  685. X`009`009    freeobj;
  686. X
  687. X`009`009    writeln('The ',obj.oname,' has slipped out of your hands.');
  688. X`009`009`009
  689. X`009`009    log_event(myslot,E_SLIPPED,0,0,obj.oname);
  690. X
  691. X`009`009    if obj.actindx > 0 then
  692. X`009`009`009run_monster('',obj.actindx,'drop you','','',
  693. X`009`009`009    sysdate+' '+systime);
  694. X
  695. X`009`009end else
  696. X`009`009    writeln('%error in maybe_drop; unsuccessful place_obj; notify Mo
  697. Vnster Manager');
  698. X
  699. X`009end;
  700. Xend;
  701. X
  702. X`123 function obj_owner moved to module CUSTOM `125
  703. X
  704. Xprocedure do_duplicate(s: string);
  705. Xlabel 0; `123 for panic `125
  706. Xvar
  707. X`009objnum,oldloc: integer;
  708. X
  709. X    function action(s: shortstring; objnum: integer): boolean;
  710. X    begin
  711. X`009if obj_owner(objnum,TRUE) then begin
  712. X`009    if not(place_obj(objnum,TRUE)) then begin
  713. X`009`009`009`123 put the new object here `125
  714. X`009`009writeln('There isn''t enough room here to make that.');
  715. X`009`009goto 0; `123 leave loop `125
  716. X`009    end else begin
  717. X`123 keep track of how many there `125`009getobj(objnum);
  718. X`123 are in existence `125`009`009`009obj.numexist := obj.numexist + 1;
  719. X`009`009`009`009`009putobj;
  720. X
  721. X`009`009log_event(myslot,E_MADEOBJ,0,0,log_name + ' has created an object he
  722. Vre.');
  723. X`009`009writeln('Object ',s,' created.');
  724. X`009    end;
  725. X`009end else
  726. X`009    writeln('Power to create ',s,' belongs to someone else.');
  727. X`009action := true;
  728. X`009checkevents(true);
  729. X`009if oldloc <> location then goto 0; `123 panic `125
  730. X    end;
  731. X   `032
  732. X    function restriction (n: integer): boolean;
  733. X`009begin
  734. X`009`009restriction := true;
  735. X`009end;
  736. X
  737. X    procedure leave;
  738. X    begin
  739. X`009writeln('EXIT - no changes.');
  740. X`009goto 0;
  741. X- 4367, 4546
  742. Xbegin
  743. X    if s = '' then grab_line('Object? ',s,eof_handler := leave);
  744. X    oldloc := location;
  745. X    if length(s) > 0 then begin
  746. X`009if not is_owner(location,TRUE) then begin
  747. X`009    `123 only let them make things if they're on their home turf `125
  748. X`009    writeln('You may only create objects when you are in one of your own
  749. V rooms.');
  750. X`009end else begin
  751. X`009    if scan_obj(action,s,,restriction) then begin
  752. X`009    end else
  753. X`009`009writeln('There is no object by that name.');
  754. X`009end;
  755. X   end else
  756. X`009writeln('To duplicate an object, type DUPLICATE <object name>.');
  757. X    0: `123 for panic `125
  758. Xend;
  759. X
  760. X
  761. X`123 make an object `125
  762. Xprocedure do_makeobj(s: string);
  763. Xlabel exit_label;
  764. Xvar
  765. X`009objnum: integer;
  766. X
  767. X    procedure leave;
  768. X    begin
  769. X`009writeln('EXIT - no changes.');
  770. X`009goto exit_label;
  771. X    end;
  772. X
  773. X
  774. Xbegin
  775. X`009if s = '' then grab_line('Object? ',s,eof_handler := leave);
  776. X
  777. X`009gethere;
  778. X`009if checkhide then begin
  779. X`009if not is_owner(location,TRUE) then begin
  780. X`009`009writeln('You may only create objects when you are in one of your own
  781. V rooms.');
  782. X`009end else if s <> '' then begin
  783. X`009`009if length(s) > shortlen then
  784. X`009`009`009writeln('Please limit your object names to ',shortlen:1,' charac
  785. Vters.')
  786. X`009`009else if exact_obj(objnum,s) then begin`009`123 object already exits
  787. V `125
  788. X`009`009`009writeln('That object already exits.  If you would like to make a
  789. Vnother copy of it,');
  790. X`009`009`009writeln('use the DUPLICATE command.');
  791. X`009`009end else begin
  792. X`009`009`009if debug then
  793. X`009`009`009`009writeln('%beggining to create object');
  794. X`009`009`009if find_numobjs < maxobjs then begin
  795. X`009`009`009`009if alloc_obj(objnum) then begin
  796. X`009`009`009`009`009if debug then
  797. X`009`009`009`009`009`009writeln('%alloc_obj successful');
  798. X`009`009`009`009`009getobjnam;
  799. X`009`009`009`009`009objnam.idents`091objnum`093 := lowcase(s);
  800. X`009`009`009`009`009putobjnam;
  801. X`009`009`009`009`009if debug then
  802. X`009`009`009`009`009`009writeln('%getobjnam completed');
  803. X`009`009`009`009`009getobjown;
  804. X`009`009`009`009`009objown.idents`091objnum`093 := userid;
  805. X`009`009`009`009`009putobjown;
  806. X`009`009`009`009`009if debug then
  807. X`009`009`009`009`009`009writeln('%getobjown completed');
  808. X
  809. X`009`009`009`009`009getobj(objnum);
  810. X`009`009`009`009`009`009obj.onum := objnum;
  811. X`009`009`009`009`009`009obj.oname := s;`009`123 name of object `125
  812. X`009`009`009`009`009`009obj.kind := 0; `123 bland object `125
  813. X`009`009`009`009`009`009obj.linedesc := DEFAULT_LINE;
  814. X`009`009`009`009`009`009obj.actindx := 0;
  815. X`009`009`009`009`009`009obj.examine := 0;
  816. X`009`009`009`009`009`009obj.numexist := 1;
  817. X`009`009`009`009`009`009obj.home := 0;
  818. X`009`009`009`009`009`009obj.homedesc := 0;
  819. X
  820. X`009`009`009`009`009`009obj.sticky := false;
  821. X`009`009`009`009`009`009obj.getobjreq := 0;
  822. X`009`009`009`009`009`009obj.getfail := 0;
  823. X`009`009`009`009`009`009obj.getsuccess := DEFAULT_LINE;
  824. X
  825. X`009`009`009`009`009`009obj.useobjreq := 0;
  826. X`009`009`009`009`009`009obj.uselocreq := 0;
  827. X`009`009`009`009`009`009obj.usefail := DEFAULT_LINE;
  828. X`009`009`009`009`009`009obj.usesuccess := DEFAULT_LINE;
  829. X
  830. X`009`009`009`009`009`009obj.usealias := '';
  831. X`009`009`009`009`009`009obj.reqalias := false;
  832. X`009`009`009`009`009`009obj.reqverb := false;
  833. X
  834. X`009`009`009if s`0911`093 in `091'a','A','e','E','i','I','o','O','u','U'`093
  835. V then
  836. X`009`009`009`009`009`009obj.particle := 2  `123 an `125
  837. X`009`009`009else
  838. X`009`009`009`009`009`009obj.particle := 1; `123 a `125
  839. X
  840. X`009`009`009`009`009`009obj.d1 := 0;
  841. X`009`009`009`009`009`009obj.d2 := 0;
  842. X`009`009`009`009`009`009obj.ap := 0;
  843. X`009`009`009`009`009`009obj.exreq := 0;
  844. X
  845. X`009`009`009`009`009`009obj.exp5 := DEFAULT_LINE;
  846. X`009`009`009`009`009`009obj.exp6 := DEFAULT_LINE;
  847. X`009`009`009`009`009putobj;
  848. X
  849. X
  850. X`009`009`009`009`009if debug then
  851. X`009`009`009`009`009`009writeln('putobj completed');
  852. X`009`009`009`009end;
  853. X`009`009`009`009`009`123 else: alloc_obj prints errors by itself `125
  854. X`009`009`009`009if not(place_obj(objnum,TRUE)) then
  855. X`009`009`009`009`009`123 put the new object here `125
  856. X`009`009`009`009`009writeln('%error in makeobj - could not place object; not
  857. Vify the Monster Manager.')
  858. X`009`009`009`009else begin
  859. X`009`009`009`009`009log_event(myslot,E_MADEOBJ,0,0,
  860. X`009`009`009`009`009`009log_name + ' has created an object here.');
  861. X`009`009`009`009`009writeln('Object created.');
  862. X`009`009`009`009end;
  863. X
  864. X`009`009`009end else
  865. X`009`009`009`009writeln('This place is too crowded to create any more object
  866. Vs.  Try somewhere else.');
  867. X`009`009end;
  868. X`009end else
  869. X`009`009writeln('To create an object, type MAKE <object name>.');
  870. X`009end;
  871. X    exit_label:
  872. Xend;
  873. X
  874. Xprocedure do_summon(s: string);
  875. Xlabel exit_label;
  876. Xvar
  877. X`009n: integer;
  878. X`009sname: string;
  879. X`009vname: string;
  880. X
  881. X`009sid: integer;
  882. X`009vslot: integer;
  883. X
  884. X    procedure leave;
  885. X    begin
  886. X`009writeln('EXIT - no changes.');
  887. X`009goto exit_label;
  888. X- 4550, 4620
  889. X`009if s = '' then grab_line('Spell? ',s,eof_handler := leave);
  890. X`009sname := s;
  891. X`009grab_line('Victim? ',s,eof_handler := leave);
  892. X`009vname := s;
  893. X
  894. X`009if not lookup_spell(sid,sname) then writeln('Unkown spell.')
  895. X`009else if not parse_pers(vslot,vname) then writeln('Victim isn''t here.')
  896. X`009else begin
  897. X`009    getspell(mylog);
  898. X`009    freespell;
  899. X`009    if spell.level`091sid`093 = 0 then writeln('Unkown spell.')
  900. X`009    else if vslot = myslot then begin
  901. X`009`009writeln('Spell summoned.');
  902. X`009`009log_event(myslot,E_SUMMON,vslot,sid);
  903. X`009`009getint(N_SPELL);
  904. X`009`009freeint;
  905. X`009`009getspell_name;
  906. X`009`009freespell_name;
  907. X`009`009run_monster('',anint.int`091sid`093,
  908. X`009`009    'summon', '','',sysdate + ' ' + systime,
  909. X`009`009    spell_name.idents`091sid`093, here.people`091myslot`093.name);
  910. X`009    end else begin
  911. X`009`009log_event(myslot,E_SUMMON,vslot,sid);
  912. X`009`009writeln('Spell summoned.');
  913. X`009    end;
  914. X`009end;
  915. X    exit_label:
  916. Xend;
  917. X
  918. X`123 remove the type block for an object; all instances of the object must
  919. X  be destroyed first `125
  920. X
  921. Xprocedure do_unmake(s: string);
  922. Xlabel exit_label;
  923. Xvar
  924. X`009n: integer;
  925. X`009tmp: string;
  926. X
  927. X    procedure leave;
  928. X    begin
  929. X`009writeln('EXIT - no changes.');
  930. X`009goto exit_label;
  931. X- 4624, 4846
  932. X`009if s = '' then grab_line('Object? ',s,eof_handler := leave);
  933. X
  934. X`009if not(is_owner(location,TRUE)) then
  935. X`009`009writeln('You must be in one of your own rooms to UNMAKE an object.')
  936. X`009else if lookup_obj(n,s,true) then begin
  937. X`009`009tmp := obj_part(n);
  938. X`009`009`009`123 this will do a getobj(n) for us `125
  939. X
  940. X`009`009if obj.numexist = 0 then begin
  941. X`009`009`009delete_obj(n);
  942. X                        delete_line(obj.linedesc);
  943. X                        delete_block(obj.homedesc);
  944. X`009`009`009delete_block(obj.examine);
  945. X                        delete_block(obj.getfail);
  946. X                        delete_block(obj.getsuccess);
  947. X`009`009`009delete_block(obj.usefail);
  948. X`009`009`009delete_block(obj.usesuccess);
  949. X                        delete_block(obj.d1);
  950. X                        delete_block(obj.d2);
  951. X`009`009`009if obj.actindx > 0 then begin `123 delete hook (hurtta@finuh) `1
  952. V25
  953. X`009`009`009`009delete_program(obj.actindx);
  954. X`009`009`009`009delete_general(I_HEADER,obj.actindx);
  955. X`009`009`009end;
  956. X
  957. X`009`009`009log_event(myslot,E_UNMAKE,0,0,tmp);
  958. X`009`009`009writeln('Object removed.');
  959. X`009`009end else
  960. X`009`009`009writeln('You must DESTROY all instances of the object first.');
  961. X`009end else
  962. X`009`009writeln('There is no object here by that name.');
  963. X    exit_label:
  964. X- 4850, 5232
  965. X
  966. X`123 destroy a copy of an object `125
  967. X
  968. Xprocedure do_destroy(s: string);
  969. Xlabel 0;    `123 for panic `125
  970. Xvar
  971. X`009slot,n,oldloc: integer;
  972. X`009pub: shortstring;
  973. X
  974. X    function action(s: shortstring; n: integer): boolean;
  975. X    begin
  976. X`009getobjown;
  977. X`009freeobjown;
  978. X`009if (objown.idents`091n`093 <> userid) and (objown.idents`091n`093 <> pub
  979. Vlic_id) and
  980. X       (not owner_priv) then begin `123 minor change by leino@finuha `125
  981. X`009    writeln('You must be the owner of ',s,' or');
  982. X`009    writeln(s,' must be public to destroy it.');
  983. X`009    action := true;
  984. X`009end else if obj_hold(n) then begin
  985. X`009    if mywear = n then x_unwear;
  986. X`009    if mywield = n then x_unwield;
  987. X
  988. X`009    slot := find_hold(n);
  989. X`009    drop_obj(slot);
  990. X
  991. X`009    log_event(myslot,E_DESTROY,0,0,
  992. X`009`009log_name + ' has destroyed ' + obj_part(n) + '.');
  993. X`009    writeln('Object destroyed.');
  994. X
  995. X`009    getobj(n);
  996. X`009    obj.numexist := obj.numexist - 1;
  997. X`009    putobj;
  998. X`009    action := true;
  999. X`009end else if obj_here(n) then begin
  1000. X`009    slot := find_obj(n);
  1001. X`009    if not take_obj(n,slot) then
  1002. X`009`009writeln('Someone picked ',s,' up before you could destroy it.')
  1003. X`009    else begin
  1004. X`009`009log_event(myslot,E_DESTROY,0,0,
  1005. X`009`009log_name + ' has destroyed ' + obj_part(n,FALSE) + '.');
  1006. X`009`009writeln('Object ',s,', destroyed.');
  1007. X
  1008. X`009`009getobj(n);
  1009. X`009`009obj.numexist := obj.numexist - 1;
  1010. X`009`009putobj;
  1011. X`009    end;
  1012. X`009    action := true;
  1013. X`009end else action := false;
  1014. X`009checkevents(TRUE);
  1015. X`009if location <> oldloc then goto 0;  `123 panic `125
  1016. X    end; `123 action `125
  1017. X
  1018. X    function restriction (n: integer): boolean;
  1019. X`009begin
  1020. X`009    restriction := obj_here(n,true) or obj_hold(n);
  1021. X`009    `123 true = not found hidden objects `125
  1022. X`009end;
  1023. X
  1024. X    procedure leave;
  1025. X    begin
  1026. X`009writeln('EXIT - no changes.');
  1027. X`009goto 0;
  1028. X    end;
  1029. X
  1030. Xbegin
  1031. X`009if s = '' then grab_line('Object? ',s,eof_handler := leave);
  1032. X
  1033. X`009oldloc := location;
  1034. X`009if length(s) = 0 then`009
  1035. X`009`009writeln('To destroy an object you own, type DESTROY <object>.')
  1036. X`009else if not is_owner(location,TRUE) then
  1037. X`009`009writeln('You must be in one of your own rooms to destroy an object.'
  1038. V)
  1039. X`009else if scan_obj(action,s,,restriction) then begin
  1040. X`009end else
  1041. X`009`009writeln('No such thing can be seen here.');
  1042. X`0090: `123 for panic `125
  1043. X- 5236, 5246
  1044. Xfunction links_possible: boolean;
  1045. Xvar
  1046. X`009i: integer;
  1047. X
  1048. Xbegin
  1049. X`009gethere;
  1050. X`009links_possible := false;
  1051. X`009if is_owner(location,TRUE) then
  1052. X`009`009links_possible := true
  1053. X`009else begin
  1054. X`009`009for i := 1 to maxexit do
  1055. X`009`009`009if (here.exits`091i`093.toloc = 0) and (here.exits`091i`093.kind
  1056. V = 5) then
  1057. X`009`009`009`009links_possible := true;
  1058. X`009end;
  1059. X- 5250, 5256
  1060. X
  1061. X`123 make a room `125
  1062. Xprocedure do_form(s: string);
  1063. Xlabel exit_label;
  1064. X    procedure leave;
  1065. X    begin
  1066. X`009writeln('EXIT - no changes.');
  1067. X`009goto exit_label;
  1068. X    end;
  1069. X
  1070. Xbegin
  1071. X`009gethere;
  1072. X`009if checkhide then begin
  1073. X`009`009if (get_counter(N_NUMROOMS,mylog)`032
  1074. X`009`009    >= get_counter(N_ALLOW,mylog))
  1075. X`009`009    and not quota_priv then begin
  1076. X`009`009    writeln('Yow haven''t room quota left.');
  1077. X`009`009    writeln('Use SHOW QUOTA to check limits.');
  1078. X`009`009end else if (get_counter(N_NUMROOMS,mylog) >= min_room) and`032
  1079. X`009`009`009(get_counter(N_ACCEPT,mylog) < min_accept) and
  1080. X`009`009`009not quota_priv then begin
  1081. X`009`009    writeln('You haven''t made Accepts enaugh.');
  1082. X`009`009    writeln('Use SHOW QUOTA to check limits.');
  1083. X
  1084. X`009`009end else if links_possible then begin
  1085. X`009`009`009if s = '' then begin
  1086. X`009`009`009`009grab_line('Room name? ',s,eof_handler := leave);
  1087. X`009`009`009end;
  1088. X`009`009`009s := slead(s);
  1089. X
  1090. X`009`009`009createroom(s);
  1091. X
  1092. X`009`009end else begin
  1093. X`009`009`009writeln('You may not create any new exits here.  Go to a place w
  1094. Vhere you can create');
  1095. X`009`009`009writeln('an exit before FORMing a new room.');
  1096. X`009`009end;
  1097. X`009end;
  1098. X    exit_label:
  1099. X- 5260, 5284
  1100. X- 5288, 5403
  1101. Xprocedure xpoof; `123 loc: integer; forward `125
  1102. Xlabel 0; `123 panic `125
  1103. Xvar
  1104. X`009targslot: integer;
  1105. X`009oldloc: integer;
  1106. X`009prevcode: integer;
  1107. X
  1108. Xbegin
  1109. X`009getnam;`009`009`123 rooms' names `125
  1110. X`009freenam;
  1111. X
  1112. X`009oldloc := location;
  1113. X`009prevcode := here.hook;
  1114. X        if here.hook > 0 then
  1115. X           run_monster('',here.hook,'poof out','target',nam.idents`091loc`09
  1116. V3,
  1117. X               sysdate+' '+systime);
  1118. X
  1119. X        if oldloc = location then meta_run('leave','target',nam.idents`091lo
  1120. Vc`093);
  1121. X
  1122. X`009if put_token(loc,targslot,here.people`091myslot`093.hiding) then begin
  1123. X`009`009if hiding then begin
  1124. X`009`009`009log_event(myslot,E_HPOOFOUT,0,0,log_name,location);
  1125. X`009`009`009log_event(myslot,E_HPOOFIN,0,0,log_name,loc);
  1126. X`009`009end else begin
  1127. X`009`009`009log_event(myslot,E_POOFOUT,0,0,log_name,location);
  1128. X`009`009`009log_event(targslot,E_POOFIN,0,0,log_name,loc);
  1129. X`009`009end;
  1130. X
  1131. X`009`009take_token(myslot,location);
  1132. X`009`009myslot := targslot;
  1133. X`009`009location := loc;
  1134. X`009`009setevent;
  1135. X
  1136. X`009`009`123 one trap `125
  1137. X                oldloc := location;`009`009
  1138. X`009`009if prevcode > 0 then`032
  1139. X`009`009    run_monster('',prevcode,'escaped','','',
  1140. X`009`009`009sysdate+' '+systime);
  1141. X`009`009if oldloc <> location then goto 0; `123 panic `125
  1142. X
  1143. X`009`009do_look; if oldloc <> location then goto 0;
  1144. X `032
  1145. X              if here.hook > 0 then
  1146. X`009`009`009run_monster('',here.hook,'poof in','','',
  1147. X`009`009`009`009sysdate+' '+systime);
  1148. X
  1149. X`009`009if location = oldloc then meta_run('enter','','');
  1150. X
  1151. X`009end else
  1152. X`009`009writeln('There is a crackle of electricity, but the poof fails.');
  1153. X`0090: `123 for panic `125
  1154. Xend;
  1155. X
  1156. Xprocedure poof_monster(n: integer; s: string); forward;
  1157. X
  1158. Xprocedure poof_other(n: integer);
  1159. Xlabel exit_label;
  1160. Xvar
  1161. X`009loc: integer;
  1162. X`009s: string;
  1163. X- 5408, 5434
  1164. X`009goto exit_label;
  1165. X    end;
  1166. X
  1167. Xbegin
  1168. X`009if not protected(n) then begin
  1169. X`009`009grab_line('What room? ',s,eof_handler := leave);
  1170. X`009`009if here.people`091n`093.kind <> P_PLAYER then`032
  1171. X`009`009    if here.people`091n`093.kind = P_MONSTER then
  1172. X`009`009`009poof_monster(n,s)
  1173. X`009`009    else writeln('%error in poof_other.')
  1174. X`009`009else if protected(n) then writeln ('You can''t poof ',here.people`09
  1175. V1n`093.name,' now.')
  1176. X`009`009    `123   !!! necessary double checking !! `125
  1177. X`009`009else if lookup_room(loc,s) then begin
  1178. X`009`009`009log_event(myslot,E_POOFYOU,n,loc);
  1179. X`009`009`009writeln;
  1180. X`009`009`009writeln('You extend your arms, muster some energy, and ',here.pe
  1181. Vople`091n`093.name,' is');
  1182. X`009`009`009writeln('engulfed in a cloud of orange smoke.');
  1183. X`009`009`009writeln;
  1184. X`009`009end else
  1185. X`009`009`009writeln('There is no room named ',s,'.');
  1186. X`009end else writeln ('You can''t poof ',here.people`091n`093.name,' now.');
  1187. X    exit_label:
  1188. Xend;
  1189. X
  1190. Xprocedure do_poof(s: string);
  1191. Xlabel exit_label;
  1192. Xvar
  1193. X`009n,loc: integer;
  1194. X        sown,town: veryshortstring;
  1195. X- 5442, 5532
  1196. Xbegin
  1197. X`009if poof_priv then begin `123 minor change by leino@finuha `125
  1198. X`009`009gethere;
  1199. X`009`009if ((lookup_room(loc,s) and parse_pers(n,s)) or (s='')) then begin
  1200. X`009`009`009grab_line('Poof who? (<RETURN> for yourself) ',s,
  1201. X`009`009`009    eof_handler := leave);
  1202. X`009`009`009if s='' then begin
  1203. X`009`009`009`009grab_line('What room? ',s,
  1204. X`009`009`009`009`009eof_handler := leave);
  1205. X`009`009`009`009if lookup_room(loc,s) then
  1206. X`009`009`009`009`009xpoof(loc);
  1207. X`009`009`009end else if parse_pers(n,s) then
  1208. X`009`009`009`009`009poof_other(n)
  1209. X`009`009`009`009else
  1210. X`009`009`009`009`009writeln('I can see no-one named ',s,' here.');
  1211. X`009`009end else if lookup_room(loc,s) then
  1212. X`009`009`009xpoof(loc)
  1213. X`009`009else if parse_pers(n,s) then
  1214. X`009`009`009poof_other(n)
  1215. X`009`009else
  1216. X`009`009`009writeln('There is no room named ',s,'.');
  1217. X
  1218. X`009end else begin `123 unprivileged poof (hurtta@finuh) `125
  1219. X            gethere;
  1220. X            sown := here.owner;
  1221. X            if s = '' then grab_line('What room? ',s,eof_handler := leave);
  1222. X            if (s = '') or (s='?') then command_help('poof')
  1223. X            else if lookup_room(loc,s) then begin
  1224. X              gethere(loc);
  1225. X              town := here.owner;
  1226. X              if (sown <> userid) or (town <> userid) then
  1227. X                 writeln ('Only Monster Manager may poof in other people''s
  1228. V rooms.')
  1229. X              else xpoof(loc);
  1230. X            end else writeln ('No such room');
  1231. X`009end;`009
  1232. X- 5536, 5544
  1233. X
  1234. X
  1235. Xprocedure link_room(origdir,targdir,targroom: integer);
  1236. Xvar owner: integer;
  1237. Xbegin
  1238. X`009`123 since exit creation involves the writing of two records,
  1239. X`009  perhaps there should be a global lock around this code,
  1240. X`009  such as a get to some obscure index field or something.
  1241. X`009  I haven't put this in because I don't believe that if this
  1242. X`009  routine fails it will seriously damage the database.
  1243. X
  1244. X`009  Actually, the lock should be on the test (do_link) but that
  1245. X`009  would be hard`009`125
  1246. X
  1247. X`009getroom;
  1248. X`009with here.exits`091origdir`093 do begin
  1249. X
  1250. X`009`009if (kind = 5) and exact_user(owner,here.owner) then
  1251. X`009`009    sub_counter(N_ACCEPT,owner);
  1252. X
  1253. X`009`009toloc := targroom;
  1254. X`009`009kind := 1; `123 type of exit, they can customize later `125
  1255. X`009`009slot := targdir; `123 exit it comes out in in target room `125
  1256. X
  1257. X`009`009init_exit(origdir);
  1258. X`009end;
  1259. X`009putroom;
  1260. X
  1261. X`009log_event(myslot,E_NEWEXIT,0,0,log_name,location);
  1262. X`009if location <> targroom then
  1263. X`009`009log_event(0,E_NEWEXIT,0,0,log_name,targroom);
  1264. X
  1265. X`009getroom(targroom);
  1266. X`009with here.exits`091targdir`093 do begin
  1267. X
  1268. X`009`009if (kind = 5) and exact_user(owner,here.owner) then
  1269. X`009`009    sub_counter(N_ACCEPT,owner);
  1270. X
  1271. X`009`009toloc := location;
  1272. X`009`009kind := 1;
  1273. X`009`009slot := origdir;
  1274. X
  1275. X`009`009init_exit(targdir);
  1276. X`009end;
  1277. X`009putroom;
  1278. X`009writeln('Exit created.  Use CUSTOM ',direct`091origdir`093,' to customiz
  1279. Ve your exit.');
  1280. Xend;
  1281. X
  1282. X
  1283. X`123
  1284. XUser procedure to link a room
  1285. X`125
  1286. Xprocedure do_link(s: string);
  1287. Xlabel exit_label;
  1288. Xvar
  1289. X`009ok: boolean;
  1290. X`009orgexitnam,targnam,trgexitnam: string;
  1291. X`009targroom,`009`123 number of target room `125
  1292. X`009targdir,`009`123 number of target exit direction `125
  1293. X`009origdir: integer;`123 number of exit direction here `125
  1294. X`009firsttime: boolean;
  1295. X- 5552, 5578
  1296. X
  1297. Xbegin
  1298. X
  1299. X`123`009gethere;`009! done in links_possible `125
  1300. X
  1301. X   if links_possible then begin
  1302. X`009log_action(link,0);
  1303. X`009if checkhide then begin
  1304. X`009writeln('Hit return alone at any prompt to terminate exit creation.');
  1305. X`009writeln;
  1306. X
  1307. X`009if s = '' then
  1308. X`009`009firsttime := false
  1309. X`009else begin
  1310. X`009`009orgexitnam := bite(s);
  1311. X`009`009firsttime := true;
  1312. X`009end;
  1313. X
  1314. X`009repeat
  1315. X`009`009if not(firsttime) then
  1316. X`009`009`009grab_line('Direction of exit? ',orgexitnam,
  1317. X`009`009`009`009eof_handler := leave)
  1318. X`009`009else
  1319. X`009`009`009firsttime := false;
  1320. X
  1321. X`009`009ok :=lookup_dir(origdir,orgexitnam,true);
  1322. X`009`009if ok then
  1323. X`009`009`009ok := can_make(origdir);
  1324. X`009until (orgexitnam = '') or ok;
  1325. X
  1326. X`009if ok then begin
  1327. X`009`009if s = '' then
  1328. X`009`009`009firsttime := false
  1329. X`009`009else begin
  1330. X`009`009`009targnam := s;
  1331. X`009`009`009firsttime := true;
  1332. X`009`009end;
  1333. X
  1334. X`009`009repeat
  1335. X`009`009`009if not(firsttime) then
  1336. X`009`009`009`009grab_line('Room to link to? ',targnam,
  1337. X`009`009`009`009    eof_handler := leave)
  1338. X`009`009`009else
  1339. X`009`009`009`009firsttime := false;
  1340. X
  1341. X`009`009`009ok := lookup_room(targroom,targnam,true);
  1342. X`009`009until (targnam = '') or ok;
  1343. X`009end;
  1344. X
  1345. X`009if ok then begin
  1346. X`009`009repeat
  1347. X`009`009`009writeln('Exit comes out in target room');
  1348. X`009`009`009grab_line('from what direction? ',trgexitnam,
  1349. X`009`009`009`009eof_handler := leave);
  1350. X`009`009`009ok := lookup_dir(targdir,trgexitnam,true);
  1351. X`009`009`009if ok then
  1352. X`009`009`009`009ok := can_make(targdir,targroom);
  1353. X`009`009until (trgexitnam='') or ok;
  1354. X`009end;
  1355. X
  1356. X`009if ok then begin `123 actually create the exit `125
  1357. X`009`009link_room(origdir,targdir,targroom);
  1358. X`009end;
  1359. X`009end;
  1360. X   end else
  1361. X`009writeln('No links are possible here.');
  1362. X- 5582, 5589
  1363. X
  1364. Xprocedure relink_room(origdir,targdir,targroom: integer);
  1365. Xvar
  1366. X`009tmp: exit;
  1367. X`009copyslot,
  1368. X`009copyloc,owner: integer;
  1369. X
  1370. Xbegin
  1371. X`009gethere;
  1372. X`009tmp := here.exits`091origdir`093;
  1373. X`009copyloc := tmp.toloc;
  1374. X`009copyslot := tmp.slot;
  1375. X
  1376. X`009getroom(targroom);
  1377. X`009here.exits`091targdir`093 := tmp;
  1378. X`009putroom;
  1379. X
  1380. X`009getroom(copyloc);
  1381. X`009here.exits`091copyslot`093.toloc := targroom;
  1382. X`009here.exits`091copyslot`093.slot := targdir;
  1383. X`009putroom;
  1384. X
  1385. X`009getroom;
  1386. X`009here.exits`091origdir`093.toloc := 0;
  1387. X`009init_exit(origdir);
  1388. X`009putroom;
  1389. Xend;
  1390. X
  1391. X
  1392. Xprocedure do_relink(s: string);
  1393. Xlabel exit_label;
  1394. Xvar
  1395. X`009ok: boolean;
  1396. X`009orgexitnam,targnam,trgexitnam: string;
  1397. X`009targroom,`009`123 number of target room `125
  1398. X`009targdir,`009`123 number of target exit direction `125
  1399. X`009origdir: integer;`123 number of exit direction here `125
  1400. X`009firsttime: boolean;
  1401. X- 5598, 5627
  1402. X`009log_action(c_relink,0);
  1403. X`009gethere;
  1404. X`009if checkhide then begin
  1405. X`009writeln('Hit return alone at any prompt to terminate exit relinking.');
  1406. X`009writeln;
  1407. X
  1408. X`009if s = '' then
  1409. X`009`009firsttime := false
  1410. X`009else begin
  1411. X`009`009orgexitnam := bite(s);
  1412. X`009`009firsttime := true;
  1413. X`009end;
  1414. X
  1415. X`009repeat
  1416. X`009`009if not(firsttime) then
  1417. X`009`009`009grab_line('Direction of exit to relink? ',orgexitnam,
  1418. X`009`009`009    eof_handler := leave)
  1419. X`009`009else
  1420. X`009`009`009firsttime := false;
  1421. X
  1422. X`009`009ok :=lookup_dir(origdir,orgexitnam,true);
  1423. X`009`009if ok then
  1424. X`009`009`009ok := can_alter(origdir);
  1425. X`009until (orgexitnam = '') or ok;
  1426. X
  1427. X`009if ok then begin
  1428. X`009`009if s = '' then
  1429. X`009`009`009firsttime := false
  1430. X`009`009else begin
  1431. X`009`009`009targnam := s;
  1432. X`009`009`009firsttime := true;
  1433. X`009`009end;
  1434. X
  1435. X`009`009repeat
  1436. X`009`009`009if not(firsttime) then
  1437. X`009`009`009`009grab_line('Room to relink exit into? ',targnam,
  1438. X`009`009`009`009    eof_handler := leave)
  1439. X`009`009`009else
  1440. X`009`009`009`009firsttime := false;
  1441. X
  1442. X`009`009`009ok := lookup_room(targroom,targnam,true);
  1443. X`009`009until (targnam = '') or ok;
  1444. X`009end;
  1445. X
  1446. X`009if ok then begin
  1447. X`009`009repeat
  1448. X`009`009`009writeln('New exit comes out in target room');
  1449. +-+-+-+-+-+-+-+-  END  OF PART 4 +-+-+-+-+-+-+-+-
  1450.