물건, 몹의 번호 찾아내기.

2007.07.04 19:50

그리움 조회 수:501 추천:71


Mordor에 있는 기능이랍니다.

무한루프 임종호님의 홈페이지에서 발췌하였습니다.

/***********************************************************************
* This function finds the object number of the given object
* from the database
*/

int find_obj_num(obj_ptr)
object *obj_ptr;
{
       int i;
       object *obj_src;

       for (i=0;i if(load_obj(i, &obj_src) < 0)
                       continue;
               if(!strcmp(obj_ptr->name, obj_src->name) && obj_ptr->ndice == obj_src->ndice) {
          free(obj_src);
                    break;
               }
free(obj_src);
}


       if(i return(i);
       else
               return(0);

}


/**********************************************************************/
/* find_crt */
/**********************************************************************/

/* This function will attempt to locate a given creature within a given */
/* list. The first parameter contains a pointer to the creature doing */
/* the search, the second contains a tag pointer to the first tag in */
/* the list. The third contains the match string, and the fourth */
/* contains the number of times to match the string. */

creature *find_crt(ply_ptr, first_ct, str, val)
creature *ply_ptr;
ctag *first_ct;
char *str;
int val;
{
   ctag *cp;
   int match=0, found=0;

   cp = first_ct;
   while(cp) {
       if(cp->crt->class >= CARETAKER && F_ISSET(cp->crt, PDMINV)) {
           cp = cp->next_tag;
           continue;
       }
       if(EQUAL(cp->crt, str) &&
          (F_ISSET(ply_ptr, PDINVI) ?
          1:!F_ISSET(cp->crt, MINVIS))) {
           match++;
           if(match == val) {
               found = 1;
               break;
           }
       }
       cp = cp->next_tag;
   }

   if(found)
       return(cp->crt);
   else
       return(0);
}

/***********************************************************************
* This function finds the creature number of the given creature
* from the database
*/
      
int find_crt_num(crt_ptr)
creature *crt_ptr;
{
       int i;
       creature *crt_src;

       for (i=0;i if(load_crt(i, &crt_src) < 0)
                       continue;
               if(!strcmp(crt_ptr->name, crt_src->name) && crt_ptr->experience == crt_src->experience) {
                       free(crt_src);
  break;
}
    free(crt_src);
       }

       if(i return(i);
       else
               return(0);

}

/***************************************************************************
* This function finds an object or creature number from the
* database.
*/

int dm_find_db(ply_ptr, cmnd)
creature *ply_ptr;
cmd *cmnd;
{
int fd, n;
object *obj_ptr;
creature *crt_ptr;

if(ply_ptr->class <= SUB_DM)
return(PROMPT);

fd=ply_ptr->fd;

if(cmnd->num < 3) {
print(fd, "Syntax: *find o|c name [#]\n");
return(0);
}

switch(low(cmnd->str[1][0])) {
case 'o':
  obj_ptr=find_obj(ply_ptr, ply_ptr->first_obj, cmnd->str[2], cmnd->val[2]);
  if(!obj_ptr)
   obj_ptr=find_obj(ply_ptr, ply_ptr->parent_rom->first_obj, cmnd->str[2], cmnd->val[2]);
  if(!obj_ptr) {
   print(fd, "그런 아이템은 없습니다.\n");
   return(0);
  }
  n=find_obj_num(obj_ptr);
  if(n)
   print(fd, "그아이템은 #%d번에 기록 돼어 있습니다.\n", n);
  else
   print(fd, "Object is unique.\n");

  break;
case 'm':
case 'c':
  crt_ptr=find_crt(ply_ptr, ply_ptr->parent_rom->first_mon, cmnd->str[2], cmnd->val[2]);
  if(!crt_ptr) {
   print(fd, "그런 괴물은 없습니다.\n");
   return(0);
  }
  n=find_crt_num(crt_ptr);
  if(n)
           print(fd, "그 괴물은 #%d에 기록 되어 있습니다.\n", n);
           else
           print(fd, "Creature is unique.\n");
           break;

default:
  print(fd, "Syntax: *find o|c name [#]\n");
  return(0);
}
}

홈지기 "그륨"  


Home-Page Ranking
  • 1위. 헤츠리
    6246점
  • 2위. 리타
    3720점
  • 3위. 소울
    3149점
  • 4위. 블루아사
    3083점
  • 5위. 카온
    2987점
  • 6위. 호날두
    2883점
  • 7위. 패르
    2415점
  • 8위. 마천랑
    2266점
  • 9위. 카이져
    2077점
  • 10위. 암흑광마
    2003점
天外天 Ranking
1위. 시이廢人
2위. 리타廢人
3위. 야이얀廢人
4위. 호리병廢人
5위. 극악서생廢人
6위. 아톰廢人
7위. 헤츠리廢人
8위. 보현진인廢人
9위. 타요廢人
10위. 공비廢人
새롬 데이터맨 IMF


XE Login