From 40a90a4138eb0b497d73c9aca1e5a8ce65693568 Mon Sep 17 00:00:00 2001 From: skotlex Date: Wed, 4 Apr 2007 21:33:48 +0000 Subject: - 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://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10158 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/atcommand.c | 75 +++++++++++++++++++++++++++++------------------------ src/map/clif.c | 10 +++++++ 2 files changed, 51 insertions(+), 34 deletions(-) (limited to 'src/map') diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 15057e75e..f77d04044 100644 --- a/src/map/atcommand.c +++ b/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) diff --git a/src/map/clif.c b/src/map/clif.c index 4844f0ac5..366fdbec9 100644 --- a/src/map/clif.c +++ b/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); } -- cgit v1.2.3-70-g09d2