Pārlūkot izejas kodu

- Cleaned @whogm. It will display the name of all gms online. If their GM level is above your own, it will only display their name, otherwise level, position, and party/guild info is displayed. GM's using gm-hide will not appear on this list.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@10158 54d463be-8e91-2dee-dedb-b68131a5f0ec
skotlex 18 gadi atpakaļ
vecāks
revīzija
e5113a4d7b
4 mainītis faili ar 58 papildinājumiem un 35 dzēšanām
  1. 4 0
      Changelog-Trunk.txt
  2. 3 1
      conf-tmpl/atcommand_athena.conf
  3. 41 34
      src/map/atcommand.c
  4. 10 0
      src/map/clif.c

+ 4 - 0
Changelog-Trunk.txt

@@ -4,6 +4,10 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 2007/04/05
+	* Cleaned @whogm. It will display the name of all gms online. If their GM
+	  level is above your own, it will only display their name, otherwise level,
+	  position, and party/guild info is displayed. GM's using gm-hide will not
+	  appear on this list.
 	* Corrected song/dances/encores reducing SP at the incorrect intervals
 	  (either never, or every second).
 2007/04/04

+ 3 - 1
conf-tmpl/atcommand_athena.conf

@@ -229,7 +229,9 @@ whomap2: 20
 // Returns list of logged in characters with their party/guild in a specifical map.
 whomap3: 20
 
-// Like @who+@who2+who3, but only for GM.
+// Displays GMs online. For those who are higher GM level than yourself,
+// only the name is shown, for the rest, it displays the same info of
+// @who+@who2+who3
 whogm: 20
 
 // Displays a sorted list of the ammount of zeny each conected player has at hand.

+ 41 - 34
src/map/atcommand.c

@@ -1877,25 +1877,21 @@ int atcommand_whomap(const int fd, struct map_session_data* sd, const char* comm
  */
 int atcommand_whogm(const int fd, struct map_session_data* sd, const char* command, const char* message)
 {
-	char temp0[100];
-	char temp1[100];
 	struct map_session_data *pl_sd, **pl_allsd;
 	int i, j, count, users;
 	int pl_GM_level, GM_level;
-	char match_text[100];
+	char match_text[200];
 	char player_name[NAME_LENGTH];
 	struct guild *g;
 	struct party_data *p;
 
 	nullpo_retr(-1, sd);
 
-	memset(temp0, '\0', sizeof(temp0));
-	memset(temp1, '\0', sizeof(temp1));
 	memset(atcmd_output, '\0', sizeof(atcmd_output));
 	memset(match_text, '\0', sizeof(match_text));
 	memset(player_name, '\0', sizeof(player_name));
 
-	if (sscanf(message, "%99[^\n]", match_text) < 1)
+	if (sscanf(message, "%199[^\n]", match_text) < 1)
 		strcpy(match_text, "");
 	for (j = 0; match_text[j]; j++)
 		match_text[j] = TOLOWER(match_text[j]);
@@ -1904,35 +1900,46 @@ int atcommand_whogm(const int fd, struct map_session_data* sd, const char* comma
 	GM_level = pc_isGM(sd);
 	pl_allsd = map_getallusers(&users);
 	for (i = 0; i < users; i++) {
-		if ((pl_sd = pl_allsd[i])) {
-			pl_GM_level = pc_isGM(pl_sd);
-			if (pl_GM_level > 0) {
-				if (!((battle_config.hide_GM_session || (pl_sd->sc.option & OPTION_INVISIBLE)) && (pl_GM_level > GM_level))) { // you can look only lower or same level
-					memcpy(player_name, pl_sd->status.name, NAME_LENGTH);
-					for (j = 0; player_name[j]; j++)
-						player_name[j] = TOLOWER(player_name[j]);
-					if (strstr(player_name, match_text) != NULL) { // search with no case sensitive
-						sprintf(atcmd_output, "Name: %s (GM:%d) | Location: %s %d %d", pl_sd->status.name, pl_GM_level, mapindex_id2name(pl_sd->mapindex), pl_sd->bl.x, pl_sd->bl.y);
-						clif_displaymessage(fd, atcmd_output);
-						sprintf(atcmd_output, "       BLvl: %d | Job: %s (Lvl: %d)", pl_sd->status.base_level, job_name(pl_sd->status.class_), pl_sd->status.job_level);
-						clif_displaymessage(fd, atcmd_output);
-						g = guild_search(pl_sd->status.guild_id);
-						if (g == NULL)
-							sprintf(temp1, "None");
-						else
-							sprintf(temp1, "%s", g->name);
-						p = party_search(pl_sd->status.party_id);
-						if (p == NULL)
-							sprintf(temp0, "None");
-						else
-							sprintf(temp0, "%s", p->party.name);
-						sprintf(atcmd_output, "       Party: '%s' | Guild: '%s'", temp0, temp1);
-						clif_displaymessage(fd, atcmd_output);
-						count++;
-					}
-				}
-			}
+		pl_sd = pl_allsd[i];
+		pl_GM_level = pc_isGM(pl_sd);
+		if (!pl_GM_level)
+			continue;
+		if (pl_sd->sc.option & OPTION_INVISIBLE)
+			continue;
+
+		if (match_text[0])
+		{
+			memcpy(player_name, pl_sd->status.name, NAME_LENGTH);
+			for (j = 0; player_name[j]; j++)
+				player_name[j] = TOLOWER(player_name[j]);
+		  	// search with no case sensitive
+			if (strstr(player_name, match_text) == NULL)
+				continue;
 		}
+		if (pl_GM_level > GM_level) {
+			sprintf(atcmd_output, "Name: %s (GM)", pl_sd->status.name);
+			clif_displaymessage(fd, atcmd_output);
+			continue;
+		}
+
+		sprintf(atcmd_output, "Name: %s (GM:%d) | Location: %s %d %d",
+			pl_sd->status.name, pl_GM_level,
+			mapindex_id2name(pl_sd->mapindex), pl_sd->bl.x, pl_sd->bl.y);
+		clif_displaymessage(fd, atcmd_output);
+
+		sprintf(atcmd_output, "       BLvl: %d | Job: %s (Lvl: %d)",
+			pl_sd->status.base_level,
+			job_name(pl_sd->status.class_), pl_sd->status.job_level);
+		clif_displaymessage(fd, atcmd_output);
+		
+		p = party_search(pl_sd->status.party_id);
+		g = guild_search(pl_sd->status.guild_id);
+	
+		sprintf(atcmd_output,"       Party: '%s' | Guild: '%s'",
+			p?p->party.name:"None", g?g->name:"None");
+
+		clif_displaymessage(fd, atcmd_output);
+		count++;
 	}
 
 	if (count == 0)

+ 10 - 0
src/map/clif.c

@@ -941,18 +941,28 @@ static int clif_set0078(struct block_list *bl, struct view_data *vd, unsigned ch
 	}
 	WBUFW(buf,14)=vd->class_;
 	WBUFW(buf,16)=vd->hair_style;  //Required for pets.
+	//18W: Weapon
 	WBUFW(buf,20)=vd->head_bottom;	//Pet armor
 	if (bl->type == BL_NPC && vd->class_ == FLAG_CLASS)
 	{	//The hell, why flags work like this?
 		WBUFL(buf,22)=emblem_id;
 		WBUFL(buf,26)=guild_id;
 	}
+	//22W: shield
+	//24W: Head top
+	//26W: Head mid
+	//28W: Hair color
+	//30W: Clothes color
 	WBUFW(buf,32)=dir;
 	WBUFL(buf,34)=guild_id;
 	WBUFL(buf,38)=emblem_id;
+	//42W: Manner
+	//44B: Karma
+	//45B: Sex
 	WBUFPOS(buf,46,bl->x,bl->y,dir);
 	WBUFB(buf,49)=5;
 	WBUFB(buf,50)=5;
+	//51BL Sit/Stand
 	WBUFW(buf,52)=clif_setlevel(lv);
 	return packet_len(0x78);
 }