home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / ABERMUD.ZIP / EXTRA.C < prev    next >
C/C++ Source or Header  |  1989-07-08  |  10KB  |  515 lines

  1. #include <stdio.h>
  2. #include "files.h"
  3. extern FILE * openlock();
  4. extern FILE * openuaf();
  5. extern FILE * openroom();
  6. extern char *oname();
  7. extern char *pname();
  8. extern char globme[];
  9. extern char wordbuf[];
  10. extern long mynum;
  11. extern long curch;
  12. extern long my_lev;
  13.  
  14.  
  15.  
  16. helpcom()
  17.     {
  18. extern char wordbuf[];
  19. extern long curch,mynum;
  20. extern char globme[];
  21. extern long my_lev;
  22. long a;
  23. char b[128];
  24. if(brkword()!= -1)
  25. {
  26.     a=fpbn(wordbuf);
  27.     if(a== -1)
  28.     {
  29.         bprintf("Help who ?\n");
  30.         return;
  31.     }
  32.     if((ploc(a)!=curch))
  33.     {
  34.         bprintf("They are not here\n");
  35.         return;
  36.     }
  37.     if(a==mynum)
  38.     {
  39.         bprintf("You can't help yourself.\n");
  40.         return;
  41.     }
  42.     if(phelping(mynum)!=-1) 
  43.     {
  44.         sprintf(b,"\001c%s\001 has stopped helping you\n",globme);
  45.         sendsys(pname(a),pname(a),-10011,curch,b);
  46.         bprintf("Stopped helping %s\n",pname(phelping(mynum)));
  47.     }
  48.     setphelping(mynum,a);
  49.     sprintf(b,"\001c%s\001 has offered to help you\n",globme);
  50.     sendsys(pname(a),pname(a),-10011,curch,b);
  51.     bprintf("OK...\n");
  52.     return;
  53.     }
  54.     closeworld();
  55.     bprintf("\001f%s\001",HELP1);
  56.     if(my_lev>9)
  57.        {
  58.        bprintf("Hit <Return> For More....\n");
  59.        pbfr();
  60.        while(getchar()!='\n');
  61.        bprintf("\001f%s\001",HELP2);
  62.        }
  63.     bprintf("\n");
  64.     if(my_lev>9999)
  65.        {
  66.        bprintf("Hit <Return> For More....\n");
  67.        pbfr();
  68.        while(getchar()!='\n');
  69.        bprintf("\001f%s\001",HELP3);
  70.        }
  71.     bprintf("\n");
  72.     }
  73.  
  74.  levcom()
  75.     {
  76.     closeworld();
  77.     bprintf("\001f%s\001",LEVELS);
  78.     }
  79.  
  80.  valuecom()
  81.     {
  82.     long a,b;
  83.     extern char wordbuf[];
  84.     extern long mynum;
  85.     if(brkword()== -1)
  86.        {
  87.        bprintf("Value what ?\n");
  88.        return;
  89.        }
  90.     b=fobna(wordbuf);
  91.     if(b== -1)
  92.        {
  93.        bprintf("There isn't one of those here.\n");
  94.        return;
  95.        }
  96.     bprintf("%s : %d points\n",wordbuf,(tscale()*(obaseval(b)))/5);
  97.     return;
  98.     }
  99.  stacom()
  100.     {
  101.     long a,b;
  102.     extern long my_lev;        
  103.     if(brkword()== -1)
  104.        {
  105.        bprintf("STATS what ?\n");
  106.        return;
  107.        }
  108.     if(my_lev<10)
  109.        {
  110.        bprintf("Sorry, this is a wizard command buster...\n");
  111.        return;
  112.        }
  113.     a=fobn(wordbuf);
  114.     if(a== -1)
  115.        {
  116.        statplyr();
  117.        return;
  118.        }
  119.     bprintf("\nItem        :%s",oname(a));
  120. if(ocarrf(a)==3) bprintf(       "\nContained in:%s",oname(oloc(a)));
  121. else
  122. {
  123.     if(ocarrf(a)!=0)bprintf("\nHeld By     :%s",pname(oloc(a)));
  124.     else
  125.        {bprintf("\nPosition    :");
  126.        showname(oloc(a));
  127. }
  128.        }
  129.     bprintf("\nState       :%d",state(a));
  130.     bprintf("\nCarr_Flag   :%d",ocarrf(a));
  131.     bprintf("\nSpare       :%d",ospare(a));
  132.     bprintf("\nMax State   :%d",omaxstate(a));
  133.     bprintf("\nBase Value  :%d",obaseval(a));
  134.     bprintf("\n");
  135.     }
  136.  examcom()
  137.     {
  138.     long a,b;
  139.     FILE *x;
  140.     char r[88];
  141.     extern long mynum,curch;
  142.     extern char globme[],wordbuf[];
  143.     if(brkword()== -1)
  144.        {
  145.        bprintf("Examine what ?\n");
  146.        return;
  147.        }
  148.     a=fobna(wordbuf);
  149.     if(a== -1)
  150.        {
  151.        bprintf("You see nothing special at all\n");
  152.        return;
  153.        }
  154.     switch(a)
  155.        {
  156.        case 144:
  157.           if(obyte(144,0)==0)
  158.              {
  159.              osetbyte(144,0,1);
  160.              bprintf("You take a scroll from the tube.\n");
  161. ocreate(145);
  162.              setoloc(145,mynum,1);
  163.              return;
  164.              }
  165.           break;
  166.        case 145:
  167.           ;
  168.           curch= -114;
  169.           bprintf("As you read the scroll you are teleported!\n");
  170.           destroy(145);
  171.           trapch(curch);
  172.           return;
  173.        case 101:
  174.           if(obyte(101,0)==0)
  175.              {
  176.              bprintf("You take a key from one pocket\n");
  177.              osetbyte(101,0,1);
  178. oclrbit(107,0);
  179.              setoloc(107,mynum,1);
  180.              return;
  181.              }
  182.           break;
  183.        case 7:
  184.           setstate(7,randperc()%3+1);
  185.           switch(state(7))
  186.              {
  187.              case 1:
  188.                 bprintf("It glows red");break;
  189.              case 2:
  190.                 bprintf("It glows blue");break;
  191.              case 3:
  192.                 bprintf("It glows green");break;
  193.                 }
  194.           bprintf("\n");
  195.           return;
  196.        case 8:
  197.           if(state(7)!=0)
  198.              {
  199.              if((iscarrby(3+state(7),mynum))&&(otstbit(3+state(7),13)))
  200.                 {
  201.                 destroy(8);
  202.                 teletrap(-1074);
  203.                 return;
  204.        case 85:
  205.           if(!obyte(83,0))
  206.              {
  207.              bprintf("Aha. under the bed you find a loaf and a rabbit pie\n");
  208.              ocreate(83);ocreate(84);
  209.              osetbyte(83,0,1);
  210.              return;
  211.              }
  212.           break;
  213.        case 91:
  214.           if(!obyte(90,0))
  215.              {
  216.              ocreate(90);bprintf("You pull an amulet from the bedding\n");
  217.              osetbyte(90,0,1);
  218.              return;
  219.              }
  220.           break;
  221.           }
  222.        }
  223.     break;
  224.     }
  225.  
  226.  sprintf(r,"%s%d",EXAMINES,a);
  227.  x=fopen(r,"r");
  228.  if(x==NULL)
  229.  {
  230.  bprintf("You see nothing special.\n");
  231.  return;
  232.  }
  233.  else
  234.  {while(getstr(x,r))
  235.     {
  236.     bprintf("%s\n",r);
  237.     }
  238.  fclose(x);
  239.  }
  240.  }
  241.  
  242.  statplyr()
  243.  {
  244.  extern char wordbuf[];
  245.  long a,b;
  246.  b=fpbn(wordbuf);
  247.  if(b== -1)
  248.  {
  249.  bprintf("Whats that ?\n");
  250.  return;
  251.  }
  252.  bprintf("Name      : %s\n",pname(b));
  253.  bprintf("Level     : %d\n",plev(b));
  254.  bprintf("Strength  : %d\n",pstr(b));
  255.  bprintf("Sex       : %s\n",(psex(b)==0)?"MALE":"FEMALE");
  256.  bprintf("Location  : ");
  257.  showname(ploc(b));
  258.  }
  259.  wizlist()
  260.  {
  261.  extern long my_lev;
  262.  if(my_lev<10)
  263.  {
  264.  bprintf("Huh ?\n");
  265.  return;
  266.  }
  267.  closeworld();
  268.  bprintf("\001f%s\001",WIZLIST);
  269.  }
  270.  
  271.  incom()
  272.  {
  273.  extern long my_lev,curch;
  274.  extern char wordbuf[];
  275.  char st[80],rn[80],rv[80];
  276.  long ex_bk[7];
  277.  extern long ex_dat[];
  278.  long a;
  279.  long x;
  280.  long y;
  281.  FILE *unit;
  282.  a=0;
  283.  if(my_lev<10){bprintf("Huh\n");return;}
  284.  while(a<7)
  285.  {
  286.  ex_bk[a]=ex_dat[a];
  287.  a++;
  288.  }
  289.  if(brkword()== -1)
  290.  {
  291.  bprintf("In where ?\n");
  292.  return;
  293.  }
  294.  strcpy(rn,wordbuf);
  295.  if(brkword()== -1)
  296.  {
  297.  bprintf("In where ?\n");
  298.  return;
  299.  }
  300.  strcpy(rv,wordbuf);
  301.  x=roomnum(rn,rv);
  302.  if(x==0)
  303.  {
  304.  bprintf("Where is that ?\n");
  305.  return;
  306.  }
  307.  getreinput(st);
  308.  y=curch;
  309.  curch=x;
  310.  closeworld();
  311.  unit=openroom(curch,"r");
  312. if(unit==NULL){curch=y;bprintf("No such room\n");return;}
  313.  lodex(unit);
  314.  fclose(unit);
  315.  openworld();
  316.  gamecom(st);
  317.  openworld();
  318.  if(curch==x)
  319.  {
  320.  a=0;
  321.  while(a<7) {ex_dat[a]=ex_bk[a];a++;}
  322.  }
  323.  curch=y;
  324.  }
  325.  smokecom()
  326.  {
  327.  lightcom();
  328.  }
  329.  
  330.  jumpcom()
  331.  {
  332.  long a,b;
  333.  extern long jumtb[],mynum,curch;
  334.  extern long my_lev;
  335.  char ms[128];
  336.  extern char globme[];
  337.  a=0;
  338.  b=0;
  339.  while(jumtb[a])
  340.  {
  341.  if(jumtb[a]==curch){b=jumtb[a+1];break;}
  342.  a+=2;
  343.  }
  344.  if(b==0){bprintf("Wheeeeee....\n");
  345.  return;}
  346.  if((my_lev<10)&&((!iscarrby(1,mynum))||(state(1)==0)))
  347.  {
  348.      curch=b;
  349.  bprintf("Wheeeeeeeeeeeeeeeee  <<<<SPLAT>>>>\n");
  350.  bprintf("You seem to be splattered all over the place\n");
  351.  loseme();
  352.  crapup("I suppose you could be scraped up - with a spatula");
  353.  }
  354.  sprintf(ms,"\001s%s\001%s has just left\n\001",globme,globme);
  355.  sendsys(globme,globme,-10000,curch,ms);
  356.  curch=b;
  357.  sprintf(ms,"\001s%s\001%s has just dropped in\n\001",globme,globme);
  358.  sendsys(globme,globme,-10000,curch,ms);
  359.  trapch(b);
  360.  }
  361.  
  362. long jumtb[]={-643,-633,-1050,-662,-1082,-1053,0,0};
  363.  
  364. wherecom()
  365.  {
  366.  extern long mynum,curch,my_lev,my_str;
  367.  extern char wordbuf[];
  368.  extern char globme[];
  369.  long cha,rnd;
  370.  extern long numobs;
  371.  if(my_str<10)
  372.  {
  373.  bprintf("You are too weak\n");
  374.  return;
  375.  }
  376.  if(my_lev<10) my_str-=2;
  377.  rnd=randperc();
  378.  cha=10*my_lev;
  379. if((iscarrby(111,mynum))||(iscarrby(121,mynum))||(iscarrby(163,mynum)))
  380.    cha=100;
  381.  closeworld();
  382.  if(rnd>cha)
  383.  {
  384.  bprintf("Your spell fails...\n");
  385.  return;
  386.  }
  387.  cha=0;
  388.  if(brkword()== -1)
  389.  {
  390.  bprintf("What is that ?\n");
  391.  return;
  392.  }
  393.  rnd=0;
  394.  while(cha<numobs)
  395.  {
  396.  if(!strcmp(oname(cha),wordbuf))
  397.     {
  398.     rnd=1;
  399. if(my_lev>9999) bprintf("[%3d]",cha);
  400.     bprintf("%16s - ",oname(cha));
  401.     if((my_lev<10)&&(ospare(cha)== -1)) bprintf("Nowhere\n");
  402.     else
  403.        desrm(oloc(cha),ocarrf(cha));
  404.     }
  405.  cha++;
  406.  }
  407.  cha=fpbn(wordbuf);
  408.  if(cha!= -1)
  409.  {
  410.  rnd++;
  411.  bprintf("%s - ",pname(cha));
  412.  desrm(ploc(cha),0);
  413.  }
  414.  if(rnd) return;
  415.  bprintf("I dont know what that is\n");
  416.  }
  417.  
  418.  desrm(loc,cf)
  419.  {
  420.  extern long my_lev;
  421.  FILE *a;
  422.  FILE *unit;
  423.  long b;
  424.  long x[32];
  425.  if((my_lev<10)&&(cf==0)&&(loc>-5))
  426.  {
  427.  bprintf("Somewhere.....\n");
  428.  return;
  429.  }
  430. if(cf==3){
  431. bprintf("In the %s\n",oname(loc));
  432. return;
  433. }
  434.  if(cf>0)
  435.  {
  436.  bprintf("Carried by \001c%s\001\n",pname(loc));
  437.  return;
  438.  }
  439.  unit=openroom(loc,"r");
  440.  if(unit==NULL)
  441.  {
  442.  bprintf("Out in the void\n");
  443.  return;
  444.  }
  445.  b=0;
  446.  while(b++<7) getstr(unit,x);
  447.  bprintf("%-36s",x);
  448. if(my_lev>9){bprintf(" | ");showname(loc);;}
  449. else bprintf("\n");
  450.  fclose(unit);
  451.  }
  452.  
  453.  
  454.  
  455. edit_world()
  456. {
  457.     extern long my_lev,numobs;
  458.     extern char wordbuf[];    
  459.     extern long ublock[];
  460.     extern long objinfo[];
  461.     char a[80],b,c,d;
  462.     extern long genarg();
  463.     extern long mynum;
  464.     if(!ptstbit(mynum,5))
  465.     {
  466.         bprintf("Must be Game Administrator\n");
  467.         return;
  468.     }    
  469.     if(brkword()==-1)
  470.     {
  471.         bprintf("Must Specify Player or Object\n");
  472.         return;
  473.     }
  474.     if(!strcmp(wordbuf,"player")) goto e_player;
  475.     if(strcmp(wordbuf,"object"))
  476.     {
  477.         bprintf("Must specify Player or Object\n");
  478.         return;
  479.     }
  480.     b=getnarg(0,numobs-1);
  481.     if(b==-1) return;
  482.     c=getnarg(0,3);
  483.     if(c==-1) return;
  484.     d=getnarg(0,0);
  485.     if(d==-1) return;
  486.     objinfo[4*b+c]=d;
  487.         bprintf("Tis done\n");
  488.         return;
  489. e_player:b=getnarg(0,47);
  490.     if(b==-1) return;
  491.     c=getnarg(0,15);
  492.     if(c==-1) return;
  493.     d=getnarg(0,0);
  494.     if(d==-1) return;
  495.     ublock[16*b+c]=d;
  496.         bprintf("Tis done\n");
  497.         return;
  498. }
  499.         
  500. long getnarg(bt,to)
  501. long bt,to;
  502. {
  503.     extern char wordbuf[];
  504.     long x;
  505.     if(brkword()==-1)
  506.     {
  507.         bprintf("Missing numeric argument\n");
  508.         return(-1);
  509.     }
  510.     x=numarg(wordbuf);
  511.     if(x<bt) {bprintf("Invalid range\n");return(-1);}
  512.     if((to)&&(x>to)) {bprintf("Invalid range\n");return(-1);}
  513.     return(x);
  514. }
  515.