Advertisement
Guest User

Untitled

a guest
Jun 12th, 2013
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. static int count_mob(struct block_list *bl, va_list ap)
  2. {
  3. struct mob_data *md = (struct mob_data*)bl;
  4. short id = va_arg(ap, short);
  5. if (md->class_ == id)
  6. return 1;
  7. return 0;
  8. }
  9.  
  10. ACMD(mapmoblist)
  11. {
  12. char temp[100];
  13. bool mob_searched[MAX_MOB_DB];
  14. bool mob_mvp[MAX_MOB_DB];
  15. struct s_mapiterator* it;
  16. unsigned short count = 0, i, mapindex = 0;
  17. int m = 0;
  18.  
  19. memset(mob_searched, 0, MAX_MOB_DB);
  20. memset(mob_mvp, 0, MAX_MOB_DB);
  21.  
  22. // if (message && *message) {
  23.  
  24. //mapindex = mapindex_name2id(message);
  25. //if (!mapindex) {
  26. // clif->message(fd, "Map not found");
  27. // return -1;
  28. //}
  29. // m = iMap->mapindex2mapid(mapindex);
  30. //} else {
  31.  
  32. mapindex = sd->mapindex;
  33. m = sd->bl.m;
  34. //}
  35.  
  36. clif->message(fd, "--------Monster Liste--------");
  37.  
  38. sprintf(temp, "Mapname: %s", mapindex_id2name(mapindex));
  39. clif->message(fd, temp);
  40. clif->message(fd, "Monsters: ");
  41.  
  42. it = mapit_geteachmob();
  43. while (true) {
  44. TBL_MOB* md = (TBL_MOB*)mapit->next(it);
  45. if (md == NULL)
  46. break;
  47. if (md->bl.m != m || md->status.hp <= 0)
  48. continue;
  49. if (mob_searched[md->class_] == true)
  50. continue;
  51. if (mob_db(md->class_)->mexp) {
  52. mob_searched[md->class_] = true;
  53. mob_mvp[md->class_] = true;
  54. continue;
  55. }
  56.  
  57. mob_searched[md->class_] = true;
  58. count = iMap->foreachinmap(count_mob, m, BL_MOB, md->class_);
  59. sprintf(temp, " %s : %d", mob_db(md->class_)->jname , count);
  60. //[%d]
  61. clif->message(fd, temp);
  62. }
  63. mapit->free(it);
  64.  
  65. clif->message(fd, "--------MVP Liste--------: ");
  66.  
  67. for (i = 1000; i < MAX_MOB_DB; i++) {
  68. if (mob_mvp[i] == true) {
  69. count = iMap->foreachinmap(count_mob, m, BL_MOB, i);
  70. sprintf(temp, " %s[%d] : %d", mob_db(i)->jname, i, count);
  71. clif->message(fd, temp);
  72. }
  73. }
  74.  
  75. return 0;
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement