Bläddra i källkod

@showmobs = shows selected mobs on mini-map

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@8527 54d463be-8e91-2dee-dedb-b68131a5f0ec
Lupus 18 år sedan
förälder
incheckning
28b1fa6ff4
3 ändrade filer med 91 tillägg och 0 borttagningar
  1. 3 0
      Changelog-Trunk.txt
  2. 87 0
      src/map/atcommand.c
  3. 1 0
      src/map/atcommand.h

+ 3 - 0
Changelog-Trunk.txt

@@ -3,6 +3,9 @@ Date	Added
 AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
+2006/08/29
+	* Added @showmobs. It shows selected mobs on your mini-map (excluding
+	  mini-bosses & MVP) thanks to KarLaeda for the command [Lupus]
 2006/08/28
 	* Modified the dancing code and Moonlit Petals in particular, so that it is
 	  treated as an ensemble like any other, it will just knockback people when

+ 87 - 0
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]
  *------------------------------------------

+ 1 - 0
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