Jump to content
  • 0

@mobalive request


Kitutty

Question


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  4
  • Reputation:   0
  • Joined:  04/08/14
  • Last Seen:  

Hello, I would ask the @mobalive command compatible to rAthena, is a command that is similar to the mobsearch, but only tells you whether the particular monster is alive or not.

Edited by Kitutty
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  386
  • Reputation:   38
  • Joined:  04/28/13
  • Last Seen:  

int atcommand_mobalive(const int fd, struct map_session_data* sd, const char* command, const char* message)
{
char mob_name[100];
int mob_id;
int number = 0;
struct s_mapiterator* it;

nullpo_retr(-1, sd);

if (!message || !*message || sscanf(message, "%99[^\n]", mob_name) < 1)
{
clif_displaymessage(fd, "Por favor, digite o nome ou id do monstro (use: @mobalive <nome ou ID>).");
return -1;
}

if ((mob_id = atoi(mob_name)) == 0)
mob_id = mobdb_searchname(mob_name);
if(mob_id > 0 && mobdb_checkid(mob_id) == 0){
snprintf(atcmd_output, sizeof atcmd_output, "Monstro inexistente %s!",mob_name);
clif_displaymessage(fd, atcmd_output);
return -1;
}
if(mob_id == atoi(mob_name) && mob_db(mob_id)->jname)
strcpy(mob_name,mob_db(mob_id)->jname); // --ja--
// strcpy(mob_name,mob_db(mob_id)->name); // --en--

snprintf(atcmd_output, sizeof atcmd_output, "Procurando pelo monstro %s em %s ", mob_name, mapindex_id2name(sd->mapindex));
clif_displaymessage(fd, atcmd_output);

it = mapit_geteachmob();
while( true )
{
TBL_MOB* md = (TBL_MOB*)mapit_next(it);
if( md == NULL )
break;// no more mobs

if( md->bl.m != sd->bl.m )
continue;
if( mob_id != -1 && md->class_ != mob_id )
continue;

++number;
if( md->spawn_timer == INVALID_TIMER )
snprintf(atcmd_output, sizeof(atcmd_output), "%2d[%s] %s", number, "Vivo", md->name);
else
snprintf(atcmd_output, sizeof(atcmd_output), "%2d[%s] %s", number, "Morto", md->name);
clif_displaymessage(fd, atcmd_output);
}
mapit_free(it);

return 0;
}

Try this.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...