summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map/atcommand.c87
-rw-r--r--src/map/atcommand.h1
2 files changed, 88 insertions, 0 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 1bdb8e39a..cff8ab8cf 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -310,6 +310,7 @@ ACMD_FUNC(homfriendly); //[orn]
ACMD_FUNC(homhungry); //[orn]
ACMD_FUNC(homtalk); //[orn]
ACMD_FUNC(hominfo); //[Toms]
+ACMD_FUNC(showmobs); //KarLaeda
/*==========================================
*AtCommandInfo atcommand_info[]構造体の定義
@@ -640,6 +641,7 @@ static AtCommandInfo atcommand_info[] = {
{ AtCommand_HomHungry, "@homhungry", 60, atcommand_homhungry },
{ AtCommand_HomTalk, "@homtalk", 0, atcommand_homtalk },
{ AtCommand_HomInfo, "@hominfo", 0, atcommand_hominfo },
+ { AtCommand_ShowMobs, "@showmobs", 10, atcommand_showmobs }, //KarLaeda
// add new commands before this line
{ AtCommand_Unknown, NULL, 1, NULL }
@@ -9803,6 +9805,91 @@ int atcommand_mobinfo(
return 0;
}
+*==========================================
+* @showmobs by KarLaeda
+* => For 5 sec displays the mobs on minimap
+*------------------------------------------
+*/
+int atshowmobs_timer(int tid, unsigned int tick, int id, int data)
+{
+ struct map_session_data *sd;
+
+ if (!session[id] || (sd = session[id]->session_data) == NULL)
+ return 0;
+
+ clif_viewpoint(sd, 1, 2, 0, 0, data, 0xFFFFFF);
+ return 1;
+}
+static int atshowmobs_sub(struct block_list *bl,va_list ap)
+{
+ int mob_id,fd;
+ struct map_session_data* sd;
+ static int number=0;
+ struct mob_data *md;
+
+ nullpo_retr(0, bl);
+
+ if(!ap){
+ number=0;
+ return 0;
+ }
+ mob_id = va_arg(ap,int);
+ fd = va_arg(ap,int);
+ sd = va_arg(ap,struct map_session_data*);
+
+ md = (struct mob_data *)bl;
+
+ if(md && fd && (mob_id==-1 || (md->class_==mob_id))){
+ clif_viewpoint(sd, 1, 1, bl->x, bl->y, ++number, 0xFFFFFF);
+ add_timer(gettick()+5000, atshowmobs_timer, fd, number);
+ }
+ return 0;
+}
+int atcommand_showmobs(
+ const int fd, struct map_session_data* sd,
+ const char* command, const char* message)
+{
+ char mob_name[100];
+ int mob_id,map_id = 0;
+
+ nullpo_retr(-1, sd);
+
+ if (sscanf(message, "%99[^\n]", mob_name) < 0)
+ 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, "Invalid mob id %s!",mob_name);
+ clif_displaymessage(fd, atcmd_output);
+ return 0;
+ }
+// Uncomment the following line to show mini-bosses & MVP.
+//#define SHOW_MVP
+#ifndef SHOW_MVP
+ if(mob_db(mob_id)->status.mode&MD_BOSS){
+ snprintf(atcmd_output, sizeof atcmd_output, "Can't show Boss mobs!");
+ clif_displaymessage(fd, atcmd_output);
+ return 0;
+ }
+#endif
+ 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--
+
+ map_id = sd->bl.m;
+
+ snprintf(atcmd_output, sizeof atcmd_output, "Mob Search... %s %s",
+ mob_name, mapindex_id2name(sd->mapindex));
+ clif_displaymessage(fd, atcmd_output);
+
+ map_foreachinmap(atshowmobs_sub, map_id, BL_MOB, mob_id, fd, sd);
+
+ atshowmobs_sub(&sd->bl,0);
+
+ return 0;
+}
+
/*==========================================
* homunculus level up [orn]
*------------------------------------------
diff --git a/src/map/atcommand.h b/src/map/atcommand.h
index 42beb0232..4b8f31185 100644
--- a/src/map/atcommand.h
+++ b/src/map/atcommand.h
@@ -282,6 +282,7 @@ enum AtCommandType {
AtCommand_HomHungry, //[orn]
AtCommand_HomTalk, //[orn]
AtCommand_HomInfo, //[Toms]
+ AtCommand_ShowMobs, //KarLaeda
// end <- Ahem, guys, don't place AtCommands after AtCommand_Unknown! [Skotlex]
AtCommand_Unknown,
AtCommand_MAX