home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / vmsnet / monhl10b / delta5 < prev    next >
Encoding:
Internet Message Format  |  1992-08-02  |  42.8 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 5/7
  5. Message-ID: <1992Jun30.214634.13277@klaava.Helsinki.FI>
  6. Date: 30 Jun 92 21:46:34 GMT
  7. Sender: hurtta@klaava.Helsinki.FI (Kari Hurtta)
  8. Followup-To: vmsnet.sources.d
  9. Organization: University of Helsinki
  10. Lines: 1343
  11.  
  12. Archive-name: monster_helsinki_104_to_105/delta5
  13. Environment: VMS, Pascal
  14. Author: Kari.Hurtta@Helsinki.FI
  15.  
  16. -+-+-+-+-+-+-+-+ START OF PART 5 -+-+-+-+-+-+-+-+
  17. X`009`009`009grab_line('from what direction? ',trgexitnam,
  18. X`009`009`009    eof_handler := leave);
  19. X`009`009`009ok := lookup_dir(targdir,trgexitnam,true);
  20. X`009`009`009if ok then
  21. X`009`009`009`009ok := can_make(targdir,targroom);
  22. X`009`009until (trgexitnam='') or ok;
  23. X`009end;
  24. X
  25. X`009if ok then begin `123 actually create the exit `125
  26. X`009`009relink_room(origdir,targdir,targroom);
  27. X`009end;
  28. X`009end;
  29. X- 5632, 5707
  30. X`123 print the room default no-go message if there is one;
  31. X  otherwise supply the generic "you can't do that." `125
  32. X
  33. Xprocedure default_fail;
  34. X
  35. Xbegin
  36. X`009if (here.exitfail <> 0) and (here.exitfail <> DEFAULT_LINE) then
  37. X`009`009print_desc(here.exitfail)
  38. X`009else
  39. X`009`009writeln('You can''t do that.');
  40. Xend;
  41. X
  42. Xprocedure  exit_fail(dir: integer);
  43. Xvar
  44. X`009tmp: string;
  45. X
  46. Xbegin
  47. X`009if (dir < 1) or (dir > maxexit) then
  48. X`009`009default_fail
  49. X`009else if (here.exits`091dir`093.fail = DEFAULT_LINE) then begin
  50. X`009`009case here.exits`091dir`093.kind of
  51. X`009`009`0095: writeln('There isn''t an exit there yet.');
  52. X`009`009`0096: writeln('You don''t have the power to go there.');
  53. X`009`009`009otherwise default_fail;
  54. X`009`009end;
  55. X`009end else if here.exits`091dir`093.fail <> 0 then
  56. X`009`009block_subs(here.exits`091dir`093.fail,myname);
  57. X
  58. X
  59. X`123 now print the exit failure message for everyone else in the room:
  60. X`009if they tried to go through a valid exit,
  61. X`009  and the exit has an other-person failure desc, then
  62. X`009`009substitute that one & use;
  63. X
  64. X`009if there is a room default other-person failure desc, then
  65. X`009`009print that;
  66. X
  67. X`009if they tried to go through a valid exit,
  68. X`009  and the exit has no required alias, then
  69. X`009`009print default exit fail
  70. X`009else
  71. X`009`009print generic "didn't leave room" message
  72. X
  73. Xcases:
  74. X1) valid/alias exit and specific fail message
  75. X2) valid/alias exit and blanket fail message
  76. X3) valid exit (no specific or blanket) "x fails to go `091direct`093"
  77. X4) alias exit and blanket fail
  78. X5) blanket fail
  79. X6) generic fail
  80. X`125
  81. X
  82. X`009if dir <> 0 then
  83. X`009`009log_event(myslot,E_FAILGO,dir,0);
  84. X- 5711, 5777
  85. X
  86. Xprocedure do_exit; `123 (exit_slot: integer)-- declared forward `125
  87. Xlabel`0090;
  88. Xvar
  89. X`009orig_slot,
  90. X`009targ_slot,
  91. X`009orig_room,
  92. X`009enter_slot,
  93. X`009targ_room,
  94. X`009old_loc,prevcode: integer;
  95. X`009doalook: boolean;
  96. X- 5783, 5907
  97. X`009if (exit_slot < 1) or (exit_slot > 6) then
  98. X`009`009exit_fail(exit_slot)
  99. X`009else if here.exits`091exit_slot`093.toloc > 0 then begin
  100. X
  101. X`009`009orig_slot := myslot;
  102. X`009`009orig_room := location;
  103. X`009`009targ_room := here.exits`091exit_slot`093.toloc;
  104. X`009`009enter_slot := here.exits`091exit_slot`093.slot;
  105. X`009`009doalook := here.exits`091exit_slot`093.autolook;
  106. X
  107. X`009`009old_loc := location;
  108. X`009`009prevcode := here.hook;
  109. X`009`009if here.hook > 0 then
  110. X`009`009`009run_monster('',here.hook,'leave',
  111. X`009`009`009`009'target',nam.idents`091targ_room`093,
  112. X`009`009`009`009sysdate+' '+systime);
  113. X`009`009if old_loc = location then meta_run('leave',
  114. X`009`009`009`009'target',nam.idents`091targ_room`093);
  115. X`009`009if old_loc = location then meta_run_2('leave',
  116. X`009`009`009`009'target',nam.idents`091targ_room`093);
  117. X`009`009if location <> old_loc then begin
  118. X`009`009`009`123 writeln ('You must interrupt walking.'); `125
  119. X`009`009`009goto 0
  120. X`009`009end;
  121. X
  122. X`009`009block_subs(here.exits`091exit_slot`093.success,myname);
  123. X               `032
  124. X`009`009`009`009`123 optimization for exit that goes nowhere;
  125. X`009`009`009`009  why go nowhere?  For special effects, we
  126. X`009`009`009`009  don't want it to take too much time,
  127. X`009`009`009`009  the logs are important because they force the
  128. X`009`009`009`009  exit descriptions, but actually moving the
  129. X`009`009`009`009  player is unnecessary `125
  130. X
  131. X`009`009if orig_room = targ_room then begin
  132. X`009`009`009log_exit(exit_slot,orig_room,orig_slot);
  133. X`009`009`009log_entry(enter_slot,targ_room,orig_slot);
  134. X`009`009`009`009`123 orig_slot in log_entry 'cause we're not
  135. X`009`009`009`009  really going anwhere `125
  136. X`009`009`009old_loc := location;
  137. X`009`009`009if doalook then
  138. X`009`009`009`009do_look;
  139. X`009`009`009if here.hook > 0 then
  140. X`009`009`009`009run_monster('',here.hook,'enter','','',
  141. X`009`009`009`009`009sysdate+' '+systime);
  142. X`009`009`009if old_loc = location then meta_run('enter','','');
  143. X`009`009`009if old_loc = location then meta_run_2('enter','','');
  144. X`009`009end else begin
  145. X`009`009`009take_token(orig_slot,orig_room);
  146. X`009`009`009if not put_token(targ_room,targ_slot) then begin
  147. X`009`009`009`009`009`123 no room in room! `125
  148. X`123 put them back! Quick! `125`009if not put_token(orig_room,myslot) then b
  149. Vegin
  150. X`009`009`009`009`009writeln('%Oh no!');
  151. X`009`009`009`009`009halt;
  152. X`009`009`009`009end;
  153. X`009`009`009end else begin
  154. X`009`009`009`009log_exit(exit_slot,orig_room,orig_slot);
  155. X`009`009`009`009log_entry(enter_slot,targ_room,targ_slot);
  156. X
  157. X`009`009`009`009myslot := targ_slot;
  158. X`009`009`009`009`123 one trap `125
  159. X`009`009`009`009location := targ_room;
  160. X`009`009`009`009old_loc := location;
  161. X`009`009`009`009setevent;
  162. X
  163. X`009`009`009`009if prevcode > 0 then`032
  164. X`009`009`009`009    run_monster('',prevcode,'escaped','','',
  165. X`009`009`009`009    sysdate+' '+systime);
  166. X`009`009`009`009if old_loc <> location then goto 0; `123 panic `125
  167. X
  168. X`009`009`009`009if doalook then
  169. X`009`009`009`009`009do_look;
  170. X`009`009`009`009if old_loc <> location then goto 0;
  171. X
  172. X`009`009`009`009if here.hook > 0 then
  173. X`009`009`009`009`009run_monster('',here.hook,'enter',
  174. X`009`009`009`009`009`009'','',
  175. X       `009`009`009`009`009`009sysdate+' '+systime);
  176. X`009`009`009`009if old_loc = location then meta_run('enter','','');
  177. X                                if old_loc = location then meta_run_2('enter
  178. V','','');
  179. X
  180. X`009`009`009end;
  181. X`009`009end;
  182. X`009end else
  183. X`009  `009exit_fail(exit_slot);
  184. X`0090: `123 if monster (NPC) trow player to somewhere `125
  185. X- 5912, 5955
  186. Xfunction cycle_open: boolean;
  187. Xvar
  188. X`009ch: char;
  189. X`009s: string;
  190. X
  191. Xbegin
  192. X`009s := systime;
  193. X`009ch := s`0915`093;
  194. X`009if ch in `091'1','3','5','7','9'`093 then
  195. X`009`009cycle_open := true
  196. X`009else
  197. X`009`009cycle_open := false;                   `032
  198. X- 5959, 6044
  199. Xfunction which_dir(var dir:integer;s: string): boolean;
  200. Xvar
  201. X`009aliasdir, exitdir: integer;
  202. X`009aliasmatch,exitmatch,
  203. X`009aliasexact,exitexact: boolean;
  204. X`009exitreq: boolean;
  205. X
  206. Xbegin
  207. X`009s := lowcase(s);
  208. X`009if lookup_alias(aliasdir,s) then
  209. X`009`009aliasmatch := true
  210. X`009else
  211. X`009`009aliasmatch := false;
  212. X`009if lookup_dir(exitdir,s) then
  213. X`009`009exitmatch := true
  214. X`009else
  215. X`009`009exitmatch := false;
  216. X`009if aliasmatch then begin
  217. X`009`009if s = here.exits`091aliasdir`093.alias then
  218. X`009`009`009aliasexact := true
  219. X`009`009else
  220. X`009`009`009aliasexact := false;
  221. X`009end else
  222. X`009`009aliasexact := false;
  223. X`009if exitmatch then begin
  224. X`009`009if (s = direct`091exitdir`093) or (s = substr(direct`091exitdir`093,
  225. V1,1)) then
  226. X`009`009`009exitexact := true
  227. X`009`009else
  228. X`009`009`009exitexact := false;
  229. X`009end else
  230. X`009`009exitexact := false;
  231. X`009if exitmatch then
  232. X`009`009exitreq := here.exits`091exitdir`093.reqalias
  233. X`009else
  234. X`009`009exitreq := false;
  235. X
  236. X`009dir := 0;
  237. X`009which_dir := true;
  238. X`009if aliasexact and exitexact then
  239. X`009`009dir := aliasdir
  240. X`009else if aliasexact then
  241. X`009`009dir := aliasdir
  242. X`009else if exitexact and not exitreq then
  243. X`009`009dir := exitdir
  244. X`009else if aliasmatch then
  245. X`009`009dir := aliasdir
  246. X`009else if exitmatch and not exitreq then
  247. X`009`009dir := exitdir
  248. X`009else if exitmatch and exitreq then begin
  249. X`009`009dir := exitdir;
  250. X`009`009which_dir := false;
  251. X`009end else begin
  252. X`009`009which_dir := false;
  253. X`009end;
  254. X- 6048, 6084
  255. Xprocedure exit_case(dir: integer);
  256. X
  257. Xbegin
  258. X`009case here.exits`091dir`093.kind of
  259. X`009`0090: exit_fail(dir);
  260. X`009`0091: do_exit(dir);  `123 more checking goes here `125
  261. X
  262. X`009`0093: if obj_hold(here.exits`091dir`093.objreq) then
  263. X`009`009`009exit_fail(dir)
  264. X`009`009   else
  265. X`009`009`009do_exit(dir);
  266. X`009`0094: if rnd100 < 34 then
  267. X`009`009`009do_exit(dir)
  268. X`009`009   else
  269. X`009`009`009exit_fail(dir);
  270. X
  271. X`009`0092: begin
  272. X`009`009`009if obj_hold(here.exits`091dir`093.objreq) then
  273. X`009`009`009`009do_exit(dir)
  274. X`009`009`009else
  275. X`009`009`009`009exit_fail(dir);
  276. X`009`009   end;
  277. X`009`0096: if obj_hold(here.exits`091dir`093.objreq) then
  278. X`009`009`009do_exit(dir)
  279. X`009`009     else
  280. X`009`009`009exit_fail(dir);
  281. X`009`0097: if cycle_open then
  282. X`009`009`009do_exit(dir)
  283. X`009`009   else
  284. X`009`009exit_fail(dir);
  285. X`009end;
  286. Xend;
  287. X
  288. X`123
  289. XPlayer wants to go to s
  290. XHandle everthing, this is the top level procedure
  291. X
  292. XCheck that he can go to s
  293. XPut him through the exit`009( in do_exit )
  294. XDo a look for him`009`009( in do_exit )
  295. X`125
  296. Xprocedure do_go(s: string;verb:boolean := true);
  297. Xlabel exit_label;
  298. Xvar
  299. X`009dir: integer;               `032
  300. X- 6092, 6151
  301. X    procedure exit_fail2(dir: integer);
  302. X    begin
  303. X`009if here.hook = 0 then exit_fail(dir)
  304. X`009else if not run_monster (
  305. X`009    '',here.hook,'wrong dir','direction',
  306. X`009    s,sysdate+' '+systime) then exit_fail(dir);
  307. X    end; `123 exit_fail2 `125
  308. X
  309. Xbegin
  310. X    if s = '' then grab_line('Direction? ',s,eof_handler := leave);
  311. X
  312. X    gethere;
  313. X    if checkhide then begin
  314. X`009if length(s) = 0 then
  315. X`009    writeln('You must give the direction you wish to travel.')
  316. X`009else begin
  317. X`009    if which_dir(dir,s) then begin
  318. X`009`009if (dir >= 1) and (dir <= maxexit) then begin
  319. X`009`009    if here.exits`091dir`093.toloc = 0 then exit_fail2(dir)
  320. X`009`009    else if here.exits`091dir`093.reqverb and not verb then`032
  321. X`009`009`009exit_fail2(dir)
  322. X`009`009    else exit_case(dir);
  323. X
  324. X`009`009end else exit_fail2(dir);
  325. X`009    end else exit_fail2(dir);
  326. X`009end;
  327. X    end;
  328. X- 6156, 6209
  329. Xprocedure nice_say(var s: string);
  330. X
  331. Xbegin
  332. X`009`009`123 capitalize the first letter of their sentence `125
  333. X
  334. X`009if s`0911`093 in `091'a'..'z'`093 then
  335. X`009`009s`0911`093 := chr( ord('A') + (ord(s`0911`093) - ord('a')) );
  336. X
  337. X`009`009`009`123 put a period on the end of their sentence if
  338. X`009`009`009  they don't use any punctuation. `125
  339. X
  340. X`009if s`091length(s)`093 in `091'a'..'z','A'..'Z'`093 then
  341. X`009`009s := s + '.';
  342. X- 6213, 6314
  343. Xprocedure do_say(s:string);
  344. Xlabel exit_label;
  345. Xvar`009old_loc: integer;
  346. X
  347. X    procedure leave;
  348. X    begin
  349. X`009writeln('EXIT - no changes.');
  350. X`009goto exit_label;
  351. X    end;
  352. X
  353. Xbegin
  354. X`009if s = '' then grab_line('Message? ',s,
  355. X`009    eof_handler := leave);
  356. X
  357. X`009if length(s) > 0 then begin
  358. X
  359. X`123`009`009if length(s) + length(myname) > 79 then begin
  360. X`009`009`009s := substr(s,1,75-length(myname));
  361. X`009`009`009writeln('Your message was truncated:');
  362. X`009`009`009writeln('-- ',s);
  363. X`009`009end;`009`009`009`009`009`125
  364. X
  365. X`009`009nice_say(s);
  366. X`009`009if hiding then
  367. X`009`009`009log_event(myslot,E_HIDESAY,0,0,s)
  368. X`009`009else
  369. X`009  `009`009log_event(myslot,E_SAY,0,0,s);
  370. X
  371. X`009`009old_loc := location;
  372. X`009`009if here.hook > 0 then`032
  373. X`009`009`009run_monster('',here.hook,'say','speech',s,
  374. X`009`009`009`009sysdate+' '+systime);
  375. X`009`009if old_loc = location then meta_run('say','speech',s);
  376. X`009end else
  377. X`009`009writeln('To talk to others in the room, type SAY <message>.');
  378. X    exit_label:
  379. Xend;
  380. X
  381. Xprocedure do_setname(s: string);
  382. Xvar
  383. X`009notice: string;
  384. X`009ok: boolean;
  385. X`009dummy: integer;
  386. X`009sprime: string;
  387. X
  388. Xbegin
  389. X  `123 if s = '' then grab_line('Name? ',s); `125
  390. X
  391. X  gethere;
  392. X  if s <> '' then begin
  393. X     if length(s) <= shortlen then begin
  394. X         sprime := lowcase(s);
  395. X`009 if (sprime = 'monster manager') and (userid <> MM_userid) then begin
  396. X            writeln('Only the Monster Manager can have that personal name.')
  397. V;
  398. X            ok := false;
  399. X         end else ok := true;
  400. X         if ok then begin
  401. X            if exact_pers(dummy,sprime) then begin
  402. X               if dummy = mylog then ok := true
  403. X               else begin`032
  404. X                  writeln('Someone already has that name.  Your personal nam
  405. Ve must be unique.');
  406. X                  ok := false;
  407. X               end;
  408. X            end;
  409. X         end;
  410. X         if ok then begin
  411. X            myname := s;
  412. X            getroom;
  413. X            notice := here.people`091myslot`093.name;
  414. X            here.people`091myslot`093.name := s;
  415. X            putroom;
  416. X            notice := notice + ' is now known as ' + s;
  417. X            if not(hiding) then log_event(0,E_SETNAM,0,0,notice);
  418. X            `123 slot 0 means notify this player also `125
  419. X            getpers;`009`123 note the new personal name in the logfile `125
  420. X            pers.idents`091mylog`093 := s; `123 don't lowcase it `125
  421. X            putpers;
  422. X         end;
  423. X     end else writeln('Please limit your personal name to ',shortlen:1,' cha
  424. Vracters.');
  425. X  end else writeln('You are known to others as ',myname);
  426. Xend;
  427. X
  428. Xprocedure meta_run; `123 (label_name,variable: shortstring;
  429. X                    value: mega_string); forward `125
  430. Xlabel 1;
  431. Xvar i: integer;
  432. X    oldloc: integer;
  433. Xbegin    `032
  434. X   oldloc := location;
  435. X   gethere;
  436. X   for i:= 1 to maxpeople do
  437. X      if here.people`091i`093.kind = P_MONSTER then`032
  438. X         if here.people`091i`093.health > 0 then begin
  439. X            run_monster (here.people`091i`093.name,
  440. X                                  here.people`091i`093.parm,
  441. X                                  label_name,variable,value,
  442. X                                  sysdate+' '+systime);
  443. X            if location <> oldloc then goto 1; `123 oobss !! `125
  444. X`009    gethere;`009    `123 this is necessary `125
  445. X         end;
  446. X  1:
  447. Xend;
  448. X
  449. Xprocedure meta_run_2; `123 (label_name,variable: shortstring;
  450. X                    value: mega_string); forward `125
  451. Xlabel 1;
  452. Xvar i: integer;
  453. X    oldloc,num: integer;
  454. Xbegin    `032
  455. X   oldloc := location;
  456. X   gethere;
  457. X   for i:= 1 to maxobjs do begin
  458. X      num := here.objs`091i`093;
  459. X      if num > 0 then begin
  460. X         getobj(num);
  461. X         freeobj;
  462. X         if obj.actindx > 0 then
  463. X            run_monster ('',obj.actindx,
  464. X                                  label_name,variable,value,
  465. X                                  sysdate+' '+systime);
  466. X         if location <> oldloc then goto 1; `123 oobss !! `125
  467. X`009 gethere;`009    `123 this is neccessary `125
  468. X      end;
  469. X  end;
  470. X  1:
  471. Xend;
  472. X
  473. X  `032
  474. Xprocedure attack_monster(mslot,power: integer);
  475. Xvar health,mid,old_health: integer;
  476. X    tmp: intrec;
  477. Xbegin
  478. X   getroom;
  479. X   if here.people`091mslot`093.kind <> P_MONSTER then begin
  480. X      freeroom;
  481. X      writeln ('%trap_1 in attack_monster. Notify Monster Manager.');
  482. X      writeln ('% I mean that really !!');
  483. X   end else begin
  484. X      if not exact_user(mid,here.people`091mslot`093.username) then begin
  485. X           freeroom;
  486. X           writeln('%trap_2 in attack_monster. Notify Monster Manager.');
  487. X           writeln('% It is best for you !');
  488. X      end else begin
  489. X         health := here.people`091mslot`093.health;
  490. X`009 old_health := health;
  491. X         health := health - power; if health < 0 then health := 0;
  492. X         here.people`091mslot`093.health := health;
  493. X         putroom;          `032
  494. X
  495. X         tmp := anint;
  496. X         getint(N_HEALTH);
  497. X         anint.int`091mid`093 := health;
  498. X         putint;
  499. X         anint := tmp;
  500. X
  501. X         if health = 0 then begin
  502. X`009    drop_everything(mslot);
  503. X`009    if old_health > 0 then`032
  504. X`009`009if monster_owner(here.people`091mslot`093.parm) <> userid then
  505. X`009`009    add_experience(here.people`091mslot`093.experience div 6 +1);
  506. X`009 end;
  507. X         if power > 0 then desc_health(mslot);
  508. X         if health > 0 then`032
  509. X            run_monster (here.people`091mslot`093.name,
  510. X                                  here.people`091mslot`093.parm,
  511. X                               'attack','','',
  512. X                               sysdate+' '+systime);
  513. X      end
  514. X   end
  515. X- 6318, 6435
  516. X`123
  517. X1234567890123456789012345678901234567890
  518. Xexample display for alignment:
  519. X
  520. X       Monster Status
  521. X    19-MAR-1988 08:59pm
  522. X
  523. X`125
  524. X
  525. Xprocedure do_who (param: string);
  526. Xlabel 1,2; `123 exit `125
  527. Xvar
  528. X`009i,j: integer;
  529. X`009ok: boolean;
  530. X`009metaok: boolean;
  531. X`009roomown: veryshortstring;
  532. X        code: integer;
  533. X`009c: char;
  534. X`009s: shortstring;
  535. X`009play,exist: indexrec;
  536. X`009write_this: boolean;
  537. X`009count: integer;
  538. X`009s1: string;
  539. X`009type_players,type_monsters: boolean;
  540. X- 6439, 6470
  541. X`009writeln('EXIT');
  542. X`009goto 2;
  543. X    end;
  544. X
  545. X
  546. Xvar short_line : boolean;
  547. Xbegin
  548. X
  549. X    short_line := terminal_line_len < 50;
  550. X
  551. X    param := lowcase(param);
  552. X    if param = '' then param := 'players';
  553. X
  554. X    type_monsters := index(param,'mon') > 0;
  555. X    type_players  := index(param,'pla') > 0;
  556. X    if param = 'all' then begin
  557. X`009type_monsters := true;
  558. X`009type_players := true;
  559. X    end;
  560. X    if param = '?' then begin
  561. X`009command_help('who');
  562. X    end else if not type_monsters and not type_players then
  563. X`009    writeln ('Type WHO ? for help.')
  564. X    else begin
  565. X
  566. X`009log_event(myslot,E_WHO,0,(rnd100 mod 4));
  567. X`009count := 0;
  568. X
  569. X`009`123 we need just about everything to print this list:
  570. X`009`009player alloc index, userids, personal names,
  571. X`009`009room names, room owners, and the log record`009`125
  572. X
  573. X`009getindex(I_ASLEEP);`009`123 Get index of people who are playing now `125
  574. X`009freeindex;
  575. X`009play := indx;
  576. X`009getindex(I_PLAYER);
  577. X`009freeindex;
  578. X`009exist := indx;
  579. X`009getuser;
  580. X`009freeuser;
  581. X`009getpers;
  582. X`009freepers;
  583. X`009getnam;
  584. X`009freenam;
  585. X`009getown;
  586. X`009freeown;
  587. X`009getint(N_LOCATION);`009`123 get where they are `125
  588. X`009freeint;
  589. X`009if not short_line then write('              ');
  590. X`009writeln('     Monster Status');
  591. X`009if not short_line then write('              ');
  592. X`009writeln('  ',sysdate,' ',systime);
  593. X`009writeln;
  594. X`009if not short_line then write('Username        ');
  595. X`009writeln('Game Name                 Where');
  596. X
  597. X
  598. X`009if (poof_priv or owner_priv) `123 or has_kind(O_ALLSEEING) `125 then `12
  599. V3 minor change by leino@finuha `125
  600. X`009`009metaok := true
  601. X`009else
  602. X`009`009metaok := false;
  603. X
  604. X`009for i := 1 to exist.top do begin
  605. X`009`009if not(exist.free`091i`093) then begin
  606. X
  607. X`009`009`009write_this := not play.free`091i`093;
  608. X                        if user.idents`091i`093 = '' then begin
  609. X                           if write_this and not short_line then`032
  610. X`009`009`009    write('<unknown>       ')
  611. X                        end else if user.idents`091i`093`0911`093 <> ':' the
  612. Vn begin
  613. X`009`009`009   if not type_players then write_this := false;
  614. X`009`009`009   if write_this and not short_line then begin
  615. X`009`009`009`009write(user.idents`091i`093);
  616. X`009`009`009`009for j := length(user.idents`091i`093) to 15 do
  617. X`009`009`009`009    write(' ');
  618. X`009`009`009   end;
  619. X                        end else begin
  620. X`009`009`009   readv(user.idents`091i`093,c,code);
  621. X`009`009`009   write_this := write_this or monster_runnable(code);
  622. X`009`009`009   if not type_monsters then write_this := false;
  623. X`009`009`009   if write_this and not short_line then begin
  624. X`009`009`009      s := monster_owner(code);
  625. X`009`009`009      write('<',class_out(s),'>');
  626. X                              for j := length(class_out(s)) to 13 do write('
  627. V ');
  628. X                           end;
  629. X                        end;
  630. X                       `032
  631. X                        if write_this then begin
  632. X`009`009`009   write(pers.idents`091i`093);
  633. X`009`009`009   j := length(pers.idents`091i`093);
  634. X`009`009`009   while j <= 25 do begin
  635. X`009`009`009      write(' ');
  636. X`009`009`009      j := j + 1;
  637. X`009`009`009   end;
  638. X                                                   `032
  639. X`009`009`009   if not(metaok) then begin
  640. X`009`009`009      roomown := own.idents`091anint.int`091i`093`093;
  641. X
  642. X`123 if a person is in a public or disowned room, or
  643. X  if they are in the domain of the WHOer, then the player should know
  644. X  where they are  `125
  645. X
  646. X`009`009`009      if (roomown = public_id) or
  647. X`009`009`009`009    (roomown = disowned_id) or
  648. X`009`009`009`009    (roomown = userid) then
  649. X`009`009`009`009`009ok := true
  650. X`009`009`009      else
  651. X`009`009`009`009`009ok := false;
  652. X
  653. X
  654. X`009`009`009   end;
  655. X
  656. X
  657. X`009`009`009   if ok or metaok then begin
  658. X`009`009`009`009writeln(nam.idents`091anint.int`091i`093`093);
  659. X`009`009`009   end else
  660. X`009`009`009`009writeln('n/a');
  661. X`009`009`009  count := count +1;
  662. X`009`009`009  if count mod ( terminal_page_len - 2) = 0 then begin
  663. X`009`009`009`009grab_line('-more-',s1,erase := true,
  664. X`009`009`009`009    eof_handler := leave);
  665. X`009`009`009`009if s1 > '' then goto 1;
  666. X`009`009`009  end;
  667. X                       end; `123 write_this `125
  668. X`009`009end;
  669. X`009end;
  670. X`0091:  `123 for quit `125
  671. X    end;
  672. X    2:
  673. X- 6474, 6486
  674. Xprocedure list_rooms(s: shortstring; PROCEDURE more);
  675. Xvar
  676. X`009first: boolean;
  677. X`009i,j,posit: integer;
  678. X
  679. X`009columns: integer;
  680. Xbegin
  681. X`009columns := terminal_line_len div 24;
  682. X`009if columns < 1 then columns := 1;
  683. X
  684. X`009first := true;
  685. X`009posit := 0;
  686. X`009for i := 1 to indx.top do begin
  687. X`009`009if (not indx.free`091i`093) and (own.idents`091i`093 = s) then begin
  688. X`009`009`009if posit = columns then begin
  689. X`009`009`009`009posit := 1;
  690. X`009`009`009`009writeln;
  691. X`009`009`009`009more;
  692. X`009`009`009end else
  693. X`009`009`009`009posit := posit + 1;
  694. X`009`009`009if first then begin
  695. X`009`009`009`009first := false;
  696. X`009`009`009`009writeln(class_out(s),':');
  697. X`009`009`009`009more;
  698. X`009`009`009end;
  699. X`009`009`009write('    ',nam.idents`091i`093);
  700. X`009`009`009for j := length(nam.idents`091i`093) to 21 do
  701. X`009`009`009`009write(' ');
  702. X`009`009end;
  703. X`009end;
  704. X`009if posit <> 3 then begin
  705. X`009`009writeln;
  706. X`009`009more;
  707. X`009end;
  708. X
  709. X`009if first then
  710. X`009`009writeln('No rooms owned by ',class_out(s))
  711. X`009else
  712. X`009`009writeln;
  713. X`009more;
  714. X- 6490, 6492
  715. Xprocedure list_all_rooms;
  716. Xlabel 1;
  717. X- 6496, 6497
  718. X`009writeln('EXIT');
  719. X`009goto 1;
  720. X    end;
  721. X
  722. Xvar
  723. X`009i,j: integer;
  724. X`009tmp: packed array`0911..maxroom`093 of boolean;
  725. X`009linecount: integer;
  726. X
  727. X    procedure more;
  728. X    var s: string;
  729. X    begin
  730. X`009linecount := linecount +1;
  731. X`009if linecount > terminal_page_len -2 then begin
  732. X`009    grab_line('-more-',s,erase:=true,
  733. X`009`009eof_handler := leave);
  734. X`009    if s > '' then goto 1;
  735. X`009    linecount := 0
  736. X`009end;
  737. X- 6501, 6658
  738. X
  739. X`009linecount := 0;
  740. X`009tmp := zero;
  741. X
  742. X`009list_rooms(public_id,more); `009`123 public rooms first `125
  743. X`009list_rooms(system_id,more); `009`123 system rooms `125
  744. X`009list_rooms(disowned_id,more); `009`123 disowned rooms next `125
  745. X`009for i := 1 to indx.top do begin
  746. X`009`009if not(indx.free`091i`093) and not(tmp`091i`093) and
  747. X`009`009   (own.idents`091i`093 <> system_id) and`032
  748. X`009`009   (own.idents`091i`093 <> disowned_id) and
  749. X`009`009   (own.idents`091i`093 <> public_id) then begin
  750. X`009`009`009`009list_rooms(own.idents`091i`093,more);`009`123 player rooms `
  751. V125
  752. X`009`009`009`009for j := 1 to indx.top do
  753. X`009`009`009`009`009if own.idents`091j`093 = own.idents`091i`093 then
  754. X`009`009`009`009`009`009tmp`091j`093 := TRUE;
  755. X`009`009end;
  756. X`009end;
  757. X    1: `123 out `125`032
  758. Xend;
  759. X
  760. Xprocedure do_rooms(s: string);
  761. Xlabel 1;
  762. X
  763. X    procedure leave;
  764. X    begin
  765. X`009writeln('EXIT');
  766. X`009goto 1;
  767. X    end;
  768. X
  769. Xvar
  770. X`009cmd: string;
  771. X`009id: shortstring;
  772. X`009listall: boolean;
  773. X`009linecount: integer;
  774. X
  775. X    procedure more;
  776. X    var s: string;
  777. X    begin
  778. X`009linecount := linecount +1;
  779. X`009if linecount > terminal_page_len -2 then begin
  780. X`009    grab_line('-more-',s,erase:=true,
  781. X`009`009eof_handler := leave);
  782. X`009    if s > '' then goto 1;
  783. X`009    linecount := 0
  784. X`009end;
  785. X    end;
  786. X
  787. X
  788. Xbegin
  789. X    linecount := 0;
  790. X    getnam;
  791. X    freenam;
  792. X    getown;
  793. X    freeown;
  794. X    getindex(I_ROOM);
  795. X    freeindex;
  796. X
  797. X    listall := false;
  798. X    s := lowcase(s);
  799. X    cmd := bite(s);
  800. X    if cmd = '?' then begin
  801. X`009command_help('rooms');
  802. X    end else begin
  803. X`009if cmd = '' then
  804. X`009`009id := userid
  805. X`009else if lookup_class(id,cmd) then   `123 hurtta@finuh `125
  806. X`009else if (cmd = '*') or (cmd = 'all') then
  807. X`009`009listall := true
  808. X`009else if length(cmd) > veryshortlen then
  809. X`009`009id := substr(cmd,1,veryshortlen)
  810. X`009else
  811. X`009`009id := cmd;
  812. X
  813. X`009if listall then begin
  814. X`009`009if poof_priv or owner_priv then `123 minor change by leino@finuha `1
  815. V25
  816. X`009`009`009list_all_rooms
  817. X`009`009else
  818. X`009`009`009writeln('You may not obtain a list of all the rooms.');
  819. X`009end else begin
  820. X`009`009if poof_priv or owner_priv or`032
  821. X`009`009`009(userid = id) or`032
  822. X`009`009`009(id = public_id) or`032
  823. X`009`009`009(id = disowned_id) then
  824. X`009`009`009`123 minor change by leino@finuha `125
  825. X`009`009`009list_rooms(id,more)
  826. X`009`009else
  827. X`009`009`009writeln('You may not list rooms that belong to another player.')
  828. V;
  829. X`009end;
  830. X    end;
  831. X    1: `123 out `125
  832. X- 6662, 6685
  833. X
  834. Xprocedure do_objects (param: string);
  835. Xlabel 0; `123 out `125
  836. Xvar
  837. X`009i: integer;
  838. X`009total,public,disowned,private,system: integer;
  839. X`009id: shortstring;
  840. X`009print_count: integer;
  841. X`009s1: string;
  842. X`009all: boolean;`032
  843. X`009player: shortstring;
  844. X`009myindex: indexrec;
  845. X- 6690, 6726
  846. X`009goto 0;
  847. X    end;
  848. X
  849. Xbegin
  850. X    param := lowcase(param);
  851. X    all := false;
  852. X    if param = '' then player := userid
  853. X    else if (param = '*') or (param = 'all') then begin
  854. X`009player := '<all objects>';
  855. X`009all := true
  856. X    end else if lookup_class(player,param) then
  857. X    else if length(param) > shortlen then`032
  858. X`009player := substr(param,1,shortlen)
  859. X    else player := param;
  860. X`009
  861. X    if param = '?' then begin
  862. X`009command_help('objects');
  863. X    end else if (player <> public_id) and (player <> disowned_id) and
  864. X`009(player <> userid) and not owner_priv then
  865. X`009writeln('You can only get list of your own objects.')
  866. X    else begin
  867. X`009if all then writeln('Objects:')
  868. X`009else writeln('Objects of ',class_out(player),':');
  869. X`009print_count := 0;
  870. X`009getobjnam;
  871. X`009freeobjnam;
  872. X`009getobjown;
  873. X`009freeobjown;
  874. X`009getindex(I_OBJECT);
  875. X`009freeindex; myindex := indx;
  876. X
  877. X`009total := 0;
  878. X`009public := 0;
  879. X`009disowned := 0;
  880. X`009private := 0;
  881. X`009system := 0;
  882. X
  883. X`009writeln;
  884. X`009for i := 1 to myindex.top do`032
  885. X`009    if not(myindex.free`091i`093) then begin
  886. X`009`009total := total + 1;
  887. X`009`009id := objown.idents`091i`093;
  888. X`009`009if id = public_id then public := public + 1
  889. X`009`009else if id = disowned_id then  disowned := disowned + 1
  890. X`009`009else if id = system_id then system := system + 1
  891. X`009`009else private := private + 1;
  892. X
  893. X`009`009if (id = player) or (all) then  begin`032
  894. X`009`009`009writeln(i:4,'    ',
  895. X`009`009`009    class_out(id):12,'    ',
  896. X`009`009`009    objnam.idents`091i`093);
  897. X`009`009`009print_count := print_count +1;
  898. X`009`009`009if print_count > terminal_page_len -2 then begin
  899. X`009`009`009    grab_line('-more-',s1,erase := true,
  900. X`009`009`009`009eof_handler := leave);
  901. X`009`009`009    if s1 > '' then goto 0;
  902. X`009`009`009    print_count := 0;
  903. X`009`009`009end;
  904. X`009`009    end;
  905. X`009    end;
  906. X`009writeln;
  907. X`009writeln('Public:      ',public:4);
  908. X`009writeln('Disowned:    ',disowned:4);
  909. X`009writeln('Private:     ',private:4);
  910. X`009writeln('System:      ',system:4);
  911. X`009writeln('             ----');
  912. X`009writeln('Total:       ',total:4);
  913. X    end;
  914. X    0:
  915. Xend;
  916. X
  917. Xprocedure do_monsters (param: string);
  918. Xlabel 0; `123 out `125
  919. Xvar
  920. X`009i: integer;
  921. X`009total,public,disowned,private,system,mid: integer;
  922. X`009id: shortstring;
  923. X`009print_count: integer;
  924. X`009s1: string;
  925. X`009all: boolean;`032
  926. X`009player: shortstring;
  927. X`009myindex: indexrec;
  928. X`009c,x: char;
  929. X
  930. X    procedure leave;
  931. X    begin
  932. X`009writeln('EXIT');
  933. X`009goto 0;
  934. X    end;
  935. X
  936. Xbegin
  937. X    param := lowcase(param);
  938. X    all := false;
  939. X    if param = '' then player := userid
  940. X    else if (param = '*') or (param = 'all') then begin
  941. X`009player := '<all monsters>';
  942. X`009all := true
  943. X    end else if lookup_class(player,param) then
  944. X    else if length(param) > shortlen then`032
  945. X`009player := substr(param,1,shortlen)
  946. X    else player := param;
  947. X`009
  948. X    if param = '?' then begin
  949. X`009command_help('monsters');
  950. X    end else if (player <> public_id) and (player <> disowned_id) and
  951. X`009(player <> userid) and not owner_priv then
  952. X`009writeln('You can only get list of your own monsters.')
  953. X    else begin
  954. X`009if all then writeln('Monsters:')
  955. X`009else writeln('Monsters of ',class_out(player),':');
  956. X`009print_count := 0;
  957. X- 6731, 6865
  958. X`009getindex(I_PLAYER);
  959. X`009freeindex; myindex := indx;
  960. X
  961. X`009total := 0;
  962. X`009public := 0;
  963. X`009disowned := 0;
  964. X`009private := 0;
  965. X`009system := 0;
  966. X
  967. X`009writeln;
  968. X`009for i := 1 to myindex.top do`032
  969. X`009    if not(myindex.free`091i`093) then begin
  970. X`009`009id := user.idents`091i`093;
  971. X`009`009if id > '' then if id`0911`093 = ':' then begin
  972. X`009`009    total := total + 1;
  973. X`009`009    readv(id,c,mid);
  974. X`009`009    id := monster_owner(mid);
  975. X
  976. X`009`009    if monster_runnable(mid) then x := '*'
  977. X`009`009    else x := ' ';
  978. X
  979. X`009`009    if id = public_id then public := public + 1
  980. X`009`009    else if id = disowned_id then  disowned := disowned + 1
  981. X`009`009    else if id = system_id then system := system + 1
  982. X`009`009    else private := private + 1;
  983. X
  984. X`009`009    if (id = player) or (all) then  begin`032
  985. X`009`009`009writeln(i:4,' ',x,'  ',
  986. X`009`009`009    class_out(id):12,'    ',
  987. X`009`009`009    pers.idents`091i`093);
  988. X`009`009`009print_count := print_count +1;
  989. X`009`009`009if print_count > terminal_page_len -2 then begin
  990. X`009`009`009    grab_line('-more-',s1,erase := true,
  991. X`009`009`009`009eof_handler := leave);
  992. X`009`009`009    if s1 > '' then goto 0;
  993. X`009`009`009    print_count := 0;
  994. X`009`009`009end;
  995. X`009`009    end;
  996. X`009`009end;
  997. X`009    end;
  998. X`009writeln;
  999. X`009writeln('Public:      ',public:4);
  1000. X`009writeln('Disowned:    ',disowned:4);
  1001. X`009writeln('Private:     ',private:4);
  1002. X`009writeln('System:      ',system:4);
  1003. X`009writeln('             ----');
  1004. X`009writeln('Total:       ',total:4);
  1005. X    end;
  1006. X    0:
  1007. Xend; `123 do_monsters `125
  1008. X
  1009. Xprocedure do_spells (param: string);
  1010. Xlabel 0; `123 out `125
  1011. Xvar
  1012. X`009i: integer;
  1013. X`009total,public,disowned,private,system: integer;
  1014. X`009id: shortstring;
  1015. X`009print_count: integer;
  1016. X`009s1: string;
  1017. X`009all: boolean;`032
  1018. X`009player: shortstring;
  1019. X
  1020. X`009myindex: indexrec;
  1021. X`009myint:   intrec;
  1022. X- 6870, 6887
  1023. X`009goto 0;
  1024. X- 6891, 6981
  1025. X    param := lowcase(param);
  1026. X    all := false;
  1027. X    if param = '' then player := userid
  1028. X    else if (param = '*') or (param = 'all') then begin
  1029. X`009player := '<all spells>';
  1030. X`009all := true
  1031. X    end else if lookup_class(player,param) then
  1032. X    else if length(param) > shortlen then`032
  1033. X`009player := substr(param,1,shortlen)
  1034. X    else player := param;
  1035. X`009
  1036. X    if param = '?' then begin
  1037. X`009command_help('spells');
  1038. X    end else if (player <> public_id) and (player <> disowned_id) and
  1039. X`009(player <> userid) and not owner_priv then
  1040. X`009writeln('You can only get list of your own spells.')
  1041. X    else begin
  1042. X`009if all then writeln('Spells:')
  1043. X`009else writeln('Spells of ',class_out(player),':');
  1044. X`009print_count := 0;
  1045. X`009getspell_name;
  1046. X`009freespell_name;
  1047. X`009getint(N_SPELL);
  1048. X`009freeint; myint := anint;
  1049. X
  1050. X`009getindex(I_SPELL);
  1051. X`009freeindex; myindex := indx;
  1052. X
  1053. X`009total := 0;
  1054. X`009public := 0;
  1055. X`009disowned := 0;
  1056. X`009private := 0;
  1057. X`009system := 0;
  1058. X
  1059. X`009writeln;
  1060. X`009for i := 1 to myindex.top do`032
  1061. X`009    if not(myindex.free`091i`093) then begin
  1062. X`009`009total := total + 1;
  1063. X`009`009id := monster_owner(myint.int`091i`093);
  1064. X`009`009if id = public_id then public := public + 1
  1065. X`009`009else if id = disowned_id then  disowned := disowned + 1
  1066. X`009`009else if id = system_id then system := system + 1
  1067. X`009`009else private := private + 1;
  1068. X
  1069. X`009`009if (id = player) or (all) then  begin`032
  1070. X`009`009`009writeln(i:4,'    ',
  1071. X`009`009`009    class_out(id):12,'    ',
  1072. X`009`009`009    spell_name.idents`091i`093);
  1073. X`009`009`009print_count := print_count +1;
  1074. X`009`009`009if print_count > terminal_page_len -2 then begin
  1075. X`009`009`009    grab_line('-more-',s1,erase := true,
  1076. X`009`009`009`009eof_handler := leave);
  1077. X`009`009`009    if s1 > '' then goto 0;
  1078. X`009`009`009    print_count := 0;
  1079. X`009`009`009end;
  1080. X`009`009    end;
  1081. X`009    end;
  1082. X`009writeln;
  1083. X`009writeln('Public:      ',public:4);
  1084. X`009writeln('Disowned:    ',disowned:4);
  1085. X`009writeln('Private:     ',private:4);
  1086. X`009writeln('System:      ',system:4);
  1087. X`009writeln('             ----');
  1088. X`009writeln('Total:       ',total:4);
  1089. X    end;
  1090. X    0:
  1091. X- 6985, 7253
  1092. Xprocedure do_claim(s: string);
  1093. Xvar
  1094. X`009n,code,mslot: integer;
  1095. X`009ok: boolean;
  1096. X`009tmp: string;
  1097. X`009oldowner : integer;
  1098. X
  1099. Xbegin
  1100. X`009if length(s) = 0 then begin`009`123 claim this room `125
  1101. X`009`009getroom;
  1102. X`009`009if not exact_user(oldowner,here.owner) then oldowner := 0;
  1103. X`009`009if (here.owner = disowned_id) or`032
  1104. X`009`009    (owner_priv and (here.owner <> system_id)) or
  1105. X`009`009    manager_priv then begin `123 minor change by leino@finuha `125
  1106. X`009`009`009`009`009    `123 and hurtta@finuh `125
  1107. X`009`009`009here.owner := userid;
  1108. X`009`009`009putroom;
  1109. X`009`009`009change_owner(oldowner,mylog);
  1110. X`009`009`009if here.hook > 0 then set_owner(here.hook,0,userid);
  1111. X`009`009`009getown;
  1112. X`009`009`009own.idents`091location`093 := userid;
  1113. X`009`009`009putown;
  1114. X`009`009`009log_event(myslot,E_CLAIM,0,0);
  1115. X`009`009`009writeln('You are now the owner of this room.');
  1116. X`009`009end else begin
  1117. X`009`009`009freeroom;
  1118. X`009`009`009if here.owner = public_id then
  1119. X`009`009`009`009writeln('This is a public room.  You may not claim it.')
  1120. X`009`009`009else if here.owner = system_id then
  1121. X`009`009`009`009writeln('The system own this room.  You may not claim it.')
  1122. X`009`009`009else
  1123. X`009`009`009`009writeln('This room has an owner.');
  1124. X`009`009end;
  1125. X`009end else if lookup_obj(n,s) then begin
  1126. X`009`009getobjown;
  1127. X`009`009freeobjown;
  1128. X      `009  `009`123*** Let the MM claim any object ***`125
  1129. X`009`009`123 jlaiho@finuh `125
  1130. X`009`009if ( (objown.idents`091n`093 = public_id)`032
  1131. X`009`009    and (not owner_priv) ) then `123 minor change by leino@finuha `1
  1132. V25
  1133. X`009`009    writeln('That is a public object.  You may DUPLICATE it, but may
  1134. V not CLAIM it.')
  1135. X`009`009else if ( (objown.idents`091n`093 = system_id)`032
  1136. X`009`009    and (not manager_priv) ) then `123 minor change by hurtta@finuha
  1137. V `125
  1138. X`009`009    writeln('That is a system''s object. ')
  1139. X`009`009else if ( (objown.idents`091n`093 <> disowned_id)`032
  1140. X`009`009    and (not owner_priv) ) then `123 minor change by leino@finuha `1
  1141. V25
  1142. X`009`009    writeln('That object has an owner.')
  1143. X`009`009else begin
  1144. X`009`009`009getobj(n);
  1145. X`009`009`009freeobj;
  1146. X`009`009`009if obj.numexist = 0 then
  1147. X`009`009`009`009ok := true
  1148. X`009`009`009else begin
  1149. X`009`009`009`009if obj_hold(n) or obj_here(n) then
  1150. X`009`009`009`009`009ok := true
  1151. X`009`009`009`009else
  1152. X`009`009`009`009`009ok := false;
  1153. X`009`009`009end;
  1154. X                       `032
  1155. X`009`009`009if ok then begin
  1156. X`009`009`009`009getobjown;
  1157. X`009`009`009`009objown.idents`091n`093 := userid;
  1158. X`009`009`009`009putobjown;
  1159. X`009`009`009`009if obj.actindx > 0 then
  1160. X`009`009`009`009`009set_owner(obj.actindx,0,userid);
  1161. X`009`009`009`009tmp := obj.oname;
  1162. X`009`009`009`009log_event(myslot,E_OBJCLAIM,0,0,tmp);
  1163. X`009`009`009`009writeln('You are now the owner of ',tmp,'.');
  1164. X`009`009`009end else
  1165. X`009`009`009`009writeln('You must have one to claim it.');
  1166. X`009`009end;
  1167. X`009end else if lookup_pers(n,s) then begin
  1168. X`009`009if parse_pers(mslot,s) then begin   `123 parse_pers make gethere `12
  1169. V5
  1170. X`009`009`009if here.people`091mslot`093.kind = P_MONSTER then begin
  1171. X          `009`009`009code := here.people`091mslot`093.parm;
  1172. X`009`009`009`009if ( (monster_owner(code) = public_id)`032
  1173. X`009`009`009`009    and (not owner_priv) ) then`032
  1174. X`009`009`009`009    writeln('That is a public monster.')
  1175. X`009`009`009`009else if ( (monster_owner(code) = system_id)`032
  1176. X`009`009`009`009    and (not manager_priv) ) then
  1177. X`009`009`009`009    writeln('That is a system''s monster.')
  1178. X`009`009`009`009else if ( (monster_owner(code) <> disowned_id)`032
  1179. X`009`009`009`009    and (not owner_priv) ) then`032
  1180. X`009`009`009`009    writeln('That monster has an owner.')
  1181. X`009`009`009`009else begin
  1182. X`009`009`009`009`009set_owner(code,0,userid);
  1183. X`009`009`009`009`009tmp := here.people`091mslot`093.name;
  1184. X`009`009`009`009`009log_event(myslot,E_OBJCLAIM,0,0,tmp);
  1185. X`009`009`009`009`009writeln('You are now the owner of ',tmp,'.');
  1186. X`009`009`009`009end;
  1187. X`009`009`009end else writeln ('That isn''t a monster.');`009`009`009
  1188. X                end else writeln ('That monster isn''t here.');
  1189. X`009end else if lookup_spell(n,s) then begin
  1190. X`009    if ( (spell_owner(n) = public_id) and (not owner_priv) ) then`032
  1191. X`009`009`009`009    writeln('That is a public spell.')
  1192. X`009    else if ( (spell_owner(n) = system_id) and (not manager_priv) ) then
  1193. X`009`009`009`009    writeln('That is a system''s spell.')
  1194. X`009    else if ( (spell_owner(n) <> disowned_id) and (not owner_priv) ) the
  1195. Vn`032
  1196. X`009`009`009`009    writeln('That spell has an owner.')
  1197. X`009    else begin
  1198. X`009`009`009`009`009getint(N_SPELL);
  1199. X`009`009`009`009`009freeint;
  1200. X`009`009`009`009`009code := anint.int`091n`093;
  1201. X`009`009`009`009`009set_owner(code,0,userid);
  1202. X`009`009`009`009`009tmp := spell_name.idents`091n`093;
  1203. X`009`009`009`009`009log_event(myslot,E_OBJCLAIM,0,0,tmp);
  1204. X`009`009`009`009`009writeln('You are now the owner of ',tmp,'.');
  1205. X`009    end;
  1206. X`009end else writeln('There is nothing here by that name to claim.');
  1207. Xend;
  1208. X
  1209. Xprocedure do_disown(s: string);
  1210. Xvar
  1211. X`009n,mslot,code,oldowner: integer;
  1212. X`009tmp: string;
  1213. Xbegin
  1214. X
  1215. X`009if length(s) = 0 then begin`009`123 claim this room `125
  1216. X`009`009getroom;
  1217. X`009`009if not exact_user(oldowner,here.owner) then oldowner := 0;
  1218. X`009`009if (here.owner = userid) or`032
  1219. X`009`009    (owner_priv and (here.owner <> system_id)) or
  1220. X`009`009    manager_priv then begin `123 minor change by leino@finuha `125
  1221. X`009`009`009getroom;
  1222. X`009`009`009here.owner := disowned_id;
  1223. X`009`009`009putroom;
  1224. X`009`009`009change_owner(oldowner,0);
  1225. X`009`009`009if here.hook > 0 then set_owner(here.hook,0,disowned_id);
  1226. X`009`009`009getown;
  1227. X`009`009`009own.idents`091location`093 := disowned_id;
  1228. X`009`009`009putown;
  1229. X`009`009`009log_event(myslot,E_DISOWN,0,0);
  1230. X`009`009`009writeln('You have disowned this room.');
  1231. X`009`009end else begin
  1232. X`009`009`009freeroom;
  1233. X`009`009`009if here.owner = system_id then
  1234. X`009`009`009    writeln('Owner of this room is system.')
  1235. X`009`009`009else writeln('You are not the owner of this room.');
  1236. X`009`009end;
  1237. X`009end else begin`009`123 disown an object `125
  1238. X`009`009if lookup_obj(n,s) then begin
  1239. X`009`009`009getobj(n);
  1240. X`009`009`009freeobj;
  1241. X`009`009`009tmp := obj.oname;
  1242. X
  1243. X`009`009`009getobjown;
  1244. X`009`009`009if (objown.idents`091n`093 = userid) or`032
  1245. X`009`009`009    (owner_priv and ( objown.idents`091n`093 <> system_id))
  1246. X`009`009`009    or manager_priv then begin
  1247. X`009`009`009`009objown.idents`091n`093 := disowned_id;
  1248. X`009`009`009`009putobjown;
  1249. X`009`009`009`009if obj.actindx > 0 then
  1250. X`009`009`009`009`009set_owner(obj.actindx,0,disowned_id);
  1251. X`009`009`009`009log_event(myslot,E_OBJDISOWN,0,0,tmp);
  1252. X`009`009`009`009writeln('You are no longer the owner of the ',tmp,'.');
  1253. X`009`009`009end else begin
  1254. X`009`009`009`009freeobjown;
  1255. X`009`009`009`009if objown.idents`091n`093 = system_id then
  1256. X`009`009`009`009    writeln('System is owner of this.')
  1257. X`009`009`009`009else writeln('You are not the owner of any such thing.');
  1258. X`009`009`009end;
  1259. X`009`009end else if lookup_pers(n,s) then begin
  1260. X`009`009`009if parse_pers(mslot,s) then begin   `123 parse_pers make gethere
  1261. V `125`009`009 `032
  1262. X`009`009`009`009if here.people`091mslot`093.kind = P_MONSTER then begin
  1263. X`009`009`009`009    code := here.people`091mslot`093.parm;
  1264. X`009`009`009`009    if (monster_owner(code) = system_id)
  1265. X`009`009`009`009`009and not manager_priv then
  1266. X`009`009`009`009`009    writeln('The owner of this monster is system.') `009
  1267. X`009`009`009`009    else if  (monster_owner(code) <> userid)`032
  1268. X`009`009`009`009`009and not owner_priv then`032
  1269. X`009`009`009`009`009    writeln('You are not the owner of this monster')
  1270. X`009`009`009`009    else begin
  1271. X`009`009`009`009`009set_owner(code,0,disowned_id);
  1272. X`009`009`009`009`009tmp := here.people`091mslot`093.name;
  1273. X`009`009`009`009`009log_event(myslot,E_OBJDISOWN,0,0,tmp);
  1274. X`009`009`009`009`009writeln('You are no longer the owner of the ',tmp,'.');
  1275. X`009`009`009`009    end;
  1276. X`009`009`009`009end else writeln ('That isn''t monster.');
  1277. X                `009end else writeln ('Here isn''t that monster.');
  1278. X`009`009end else if lookup_spell(n,s) then begin
  1279. X`009`009    if (spell_owner(n) = system_id) and not manager_priv then
  1280. X`009`009`009writeln('The owner of this spell is system.') `009
  1281. X`009`009    else if (spell_owner(n) <> userid) and not owner_priv then`032
  1282. X`009`009`009writeln('You are not the owner of this spell')
  1283. X`009`009    else begin
  1284. X`009`009`009getint(N_SPELL);
  1285. X`009`009`009freeint;
  1286. X`009`009`009code := anint.int`091n`093;
  1287. X`009`009`009set_owner(code,0,disowned_id);
  1288. X`009`009`009tmp := spell_name.idents`091n`093;
  1289. X`009`009`009log_event(myslot,E_OBJDISOWN,0,0,tmp);
  1290. X`009`009`009writeln('You are no longer the owner of the ',tmp,'.');
  1291. X`009`009    end;
  1292. X`009`009end else writeln('You are not the owner of any such thing.');
  1293. X`009end;
  1294. X- 7257, 7417
  1295. Xprocedure do_public(s: string);
  1296. Xvar
  1297. X`009ok: boolean;
  1298. X`009tmp: string;
  1299. X`009n,mslot,code,oldowner: integer;
  1300. X`009pub: shortstring;
  1301. X
  1302. Xbegin
  1303. X
  1304. X`009if manager_priv then begin `123 minor change by leino@finuha `125
  1305. X`009`009if length(s) = 0 then begin
  1306. X`009`009`009getroom;
  1307. X`009`009`009if not exact_user(oldowner,here.owner) then oldowner := 0;
  1308. X`009`009`009here.owner := public_id;
  1309. X`009`009`009putroom;
  1310. X`009`009`009change_owner(oldowner,0);
  1311. X`009`009`009if here.hook > 0 then set_owner(here.hook,0,public_id);
  1312. X`009`009`009getown;
  1313. X`009`009`009own.idents`091location`093 := public_id;
  1314. X`009`009`009putown;
  1315. X`009`009`009writeln('This room is now public.');
  1316. X
  1317. X`009`009end else if lookup_obj(n,s) then begin
  1318. X`009`009`009getobj(n);
  1319. X`009`009`009freeobj;
  1320. X`009`009`009if obj.numexist = 0 then ok := true
  1321. X`009`009`009else begin
  1322. X`009`009`009    if obj_hold(n) or obj_here(n) then ok := true
  1323. X`009`009`009    else ok := false;
  1324. X`009`009`009end;
  1325. X
  1326. X`009`009`009if ok then begin
  1327. X`009`009`009    getobjown;
  1328. X`009`009`009    objown.idents`091n`093 := public_id;
  1329. X`009`009`009    putobjown;
  1330. X`009`009`009    if obj.actindx > 0 then
  1331. X`009`009`009`009set_owner(obj.actindx,0,public_id);
  1332. X
  1333. X`009`009`009    tmp := obj.oname;
  1334. X`009`009`009    log_event(myslot,E_OBJPUBLIC,0,0,tmp);
  1335. X`009`009`009    writeln('The ',tmp,' is now public.');
  1336. X`009`009`009end else
  1337. X`009`009`009`009    writeln('You must have one to claim it.');
  1338. X- 7422, 7433
  1339. X`009`009`009`009    set_owner(code,0,public_id);
  1340. X`009`009`009`009    tmp := here.people`091mslot`093.name;
  1341. X`009`009`009`009    log_event(myslot,E_OBJPUBLIC,0,0,tmp);
  1342. X`009`009`009`009    writeln('The ',tmp,' is now public.');
  1343. X- 7437, 7451
  1344. X`009`009    getint(N_SPELL);
  1345. X`009`009    freeint;
  1346. X`009`009    code := anint.int`091n`093;
  1347. X`009`009    set_owner(code,0,public_id);
  1348. X`009`009    tmp := spell_name.idents`091n`093;
  1349. X`009`009    log_event(myslot,E_OBJPUBLIC,0,0,tmp);
  1350. X`009`009    writeln('The ',tmp,' is now public.');
  1351. X`009`009end else writeln('There is nothing here by that name to make public.
  1352. V');
  1353. X`009end else
  1354. +-+-+-+-+-+-+-+-  END  OF PART 5 +-+-+-+-+-+-+-+-
  1355.