diff options
author | shennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-05-01 21:57:53 +0000 |
---|---|---|
committer | shennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-05-01 21:57:53 +0000 |
commit | 3f930b2176fb290ce7f23fce9b3c1e4016c4485b (patch) | |
tree | 226ba3e4b265fdca72f5967be5654e5eee3bbce4 /src/map | |
parent | d4b1eab9ed53639253ebad548422a2bf09c9b2ea (diff) | |
download | hercules-3f930b2176fb290ce7f23fce9b3c1e4016c4485b.tar.gz hercules-3f930b2176fb290ce7f23fce9b3c1e4016c4485b.tar.bz2 hercules-3f930b2176fb290ce7f23fce9b3c1e4016c4485b.tar.xz hercules-3f930b2176fb290ce7f23fce9b3c1e4016c4485b.zip |
Added @accinfo atcommand. "Huge thanks to"/"Credits to" Dekamaster/Nightroad <3.
All the queries are handled by char-server.
You might notice there is a odd way to retrieve job names in char server, this is only temporary until we're done arguing what'd be the best way to do it in char and map server.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16025 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/atcommand.c | 18 | ||||
-rw-r--r-- | src/map/intif.c | 37 | ||||
-rw-r--r-- | src/map/intif.h | 3 | ||||
-rw-r--r-- | src/map/npc_chat.c | 2 |
4 files changed, 58 insertions, 2 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 691cf2560..cad37b28f 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -8452,6 +8452,23 @@ ACMD_FUNC(new_mount) { return 0; } +ACMD_FUNC(accinfo) { + char query[NAME_LENGTH]; + + if (!message || !*message || strlen(message) > NAME_LENGTH ) { + clif_displaymessage(fd, "(usage: @accinfo/@accountinfo <account_id/char name>)."); + clif_displaymessage(fd, "You may search partial name by making use of '%' in the search, \"@accinfo %Mario%\" lists all characters whose name contain \"Mario\""); + return -1; + } + + //remove const type + safestrncpy(query, message, NAME_LENGTH); + + intif_request_accinfo( sd->fd, sd->bl.id, sd->group_id, query ); + + return 0; +} + /** * Fills the reference of available commands in atcommand DBMap **/ @@ -8695,6 +8712,7 @@ void atcommand_basecommands(void) { ACMD_DEF(delitem), ACMD_DEF(charcommands), ACMD_DEF(font), + ACMD_DEF(accinfo), /** * For Testing Purposes, not going to be here after we're done. **/ diff --git a/src/map/intif.c b/src/map/intif.c index ce0ad8e6a..c88d4a579 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -34,7 +34,7 @@ static const int packet_len_table[]={ - -1,-1,27,-1, -1, 0,37, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3800-0x380f + -1,-1,27,-1, -1, 0,37, 522, 0, 0, 0, 0, 0, 0, 0, 0, //0x3800-0x380f 0, 0, 0, 0, 0, 0, 0, 0, -1,11, 0, 0, 0, 0, 0, 0, //0x3810 39,-1,15,15, 14,19, 7,-1, 0, 0, 0, 0, 0, 0, 0, 0, //0x3820 10,-1,15, 0, 79,19, 7,-1, 0,-1,-1,-1, 14,67,186,-1, //0x3830 @@ -2077,6 +2077,40 @@ int intif_parse_elemental_saved(int fd) return 0; } +void intif_request_accinfo( int u_fd, int aid, int group_id, char* query ) { + + + WFIFOHEAD(inter_fd,2 + 4 + 4 + 4 + NAME_LENGTH); + + WFIFOW(inter_fd,0) = 0x3007; + WFIFOL(inter_fd,2) = u_fd; + WFIFOL(inter_fd,6) = aid; + WFIFOL(inter_fd,10) = group_id; + safestrncpy(WFIFOP(inter_fd,14), query, NAME_LENGTH); + + WFIFOSET(inter_fd,2 + 4 + 4 + 4 + NAME_LENGTH); + + return; +} + +void intif_parse_MessageToFD(int fd) { + int u_fd = RFIFOL(fd,2); + + if( session[u_fd] && session[u_fd]->session_data ) { + int aid = RFIFOL(fd,6); + struct map_session_data * sd = session[u_fd]->session_data; + /* matching e.g. previous fd owner didn't dc during request or is still the same */ + if( sd->bl.id == aid ) { + char msg[512]; + safestrncpy(msg, (char*)RFIFOP(fd,10), 512); + clif_displaymessage(u_fd,msg); + } + + } + + return; +} + //----------------------------------------------------------------- // inter serverからの通信 // エラーがあれば0(false)を返すこと @@ -2115,6 +2149,7 @@ int intif_parse(int fd) case 0x3803: mapif_parse_WisToGM(fd); break; case 0x3804: intif_parse_Registers(fd); break; case 0x3806: intif_parse_ChangeNameOk(fd); break; + case 0x3807: intif_parse_MessageToFD(fd); break; case 0x3818: intif_parse_LoadGuildStorage(fd); break; case 0x3819: intif_parse_SaveGuildStorage(fd); break; case 0x3820: intif_parse_PartyCreated(fd); break; diff --git a/src/map/intif.h b/src/map/intif.h index c5f6cb158..081667545 100644 --- a/src/map/intif.h +++ b/src/map/intif.h @@ -104,6 +104,9 @@ int intif_elemental_request(int ele_id, int char_id); int intif_elemental_delete(int ele_id); int intif_elemental_save(struct s_elemental *ele); +/* @accinfo */ +void intif_request_accinfo( int u_fd, int aid, int group_id, char* query ); + int CheckForCharServer(void); #endif /* _INTIF_H_ */ diff --git a/src/map/npc_chat.c b/src/map/npc_chat.c index 77c875a7e..39a3a8584 100644 --- a/src/map/npc_chat.c +++ b/src/map/npc_chat.c @@ -14,7 +14,7 @@ #include "pc.h" // struct map_session_data #include "script.h" // set_var() -#include <pcre.h> +#include "../../3rdparty/pcre/include/pcre.h" #include <stdio.h> #include <stdlib.h> |