From 760a86e1c577f776986f4558726a1784317037bb Mon Sep 17 00:00:00 2001 From: skotlex Date: Sat, 27 Jan 2007 00:31:29 +0000 Subject: - Moved the pet rename code from int_pet.c to inter.c and normalized it so it can be used for any object. - Made homunculus renaming go through the char-server so it can be validated against the allowed characters setting. - Added battle config hom_rename so you can enable renaming multiple times your homunc. - Updated the hardcoded defaults for gvg-damage to what they should be. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9720 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/char/int_pet.c | 41 ----------------------------------------- src/char/inter.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 43 deletions(-) (limited to 'src/char') diff --git a/src/char/int_pet.c b/src/char/int_pet.c index 81c485f18..d1448c5a1 100644 --- a/src/char/int_pet.c +++ b/src/char/int_pet.c @@ -221,18 +221,6 @@ int mapif_delete_pet_ack(int fd,int flag) return 0; } -int mapif_rename_pet_ack(int fd, int account_id, int char_id, int flag, char *name){ - WFIFOHEAD(fd, NAME_LENGTH+12); - WFIFOW(fd, 0) =0x3884; - WFIFOL(fd, 2) =account_id; - WFIFOL(fd, 6) =char_id; - WFIFOB(fd, 10) =flag; - memcpy(WFIFOP(fd, 11), name, NAME_LENGTH); - WFIFOSET(fd, NAME_LENGTH+12); - - return 0; -} - int mapif_create_pet(int fd,int account_id,int char_id,short pet_class,short pet_lv,short pet_egg_id, short pet_equip,short intimate,short hungry,char rename_flag,char incuvate,char *pet_name) { @@ -343,28 +331,6 @@ int mapif_delete_pet(int fd,int pet_id) return 0; } -int mapif_rename_pet(int fd, int account_id, int char_id, char *name){ - int i; - - // Check Authorised letters/symbols in the name of the pet - if (char_name_option == 1) { // only letters/symbols in char_name_letters are authorised - for (i = 0; i < NAME_LENGTH && name[i]; i++) - if (strchr(char_name_letters, name[i]) == NULL) { - mapif_rename_pet_ack(fd, account_id, char_id, 0, name); - return 0; - } - } else if (char_name_option == 2) { // letters/symbols in char_name_letters are forbidden - for (i = 0; i < NAME_LENGTH && name[i]; i++) - if (strchr(char_name_letters, name[i]) != NULL) { - mapif_rename_pet_ack(fd, account_id, char_id, 0, name); - return 0; - } - } - - mapif_rename_pet_ack(fd, account_id, char_id, 1, name); - return 0; -} - int mapif_parse_CreatePet(int fd) { RFIFOHEAD(fd); @@ -394,12 +360,6 @@ int mapif_parse_DeletePet(int fd) return 0; } -int mapif_parse_RenamePet(int fd){ - RFIFOHEAD(fd); - mapif_rename_pet(fd, RFIFOL(fd, 2), RFIFOL(fd, 6), RFIFOP(fd, 10)); - return 0; -} - // map server からの通信 // ・1パケットのみ解析すること // ・パケット長データはinter.cにセットしておくこと @@ -413,7 +373,6 @@ int inter_pet_parse_frommap(int fd) case 0x3081: mapif_parse_LoadPet(fd); break; case 0x3082: mapif_parse_SavePet(fd); break; case 0x3083: mapif_parse_DeletePet(fd); break; - case 0x3084: mapif_parse_RenamePet(fd); break; default: return 0; } diff --git a/src/char/inter.c b/src/char/inter.c index 8c5d1c641..f1e1cd592 100644 --- a/src/char/inter.c +++ b/src/char/inter.c @@ -49,7 +49,7 @@ int inter_send_packet_length[]={ }; // recv. packet list int inter_recv_packet_length[]={ - -1,-1, 7,-1, -1,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3000-0x300f + -1,-1, 7,-1, -1,13,36, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3000-0x300f 6,-1, 0, 0, 0, 0, 0, 0, 10,-1, 0, 0, 0, 0, 0, 0, //0x3010-0x301f -1, 6,-1,14, 14,19, 6,-1, 14,14, 0, 0, 0, 0, 0, 0, //0x3020-0x302f -1, 6,-1,-1, 55,19, 6,-1, 14,-1,-1,-1, 14,19,186,-1, //0x3030-0x303f @@ -57,7 +57,7 @@ int inter_recv_packet_length[]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 48,14,-1, 6, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3080-0x308f + 48,14,-1, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3080-0x308f -1,10,-1, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x3090 - 0x309f Homunculus packets [albator] }; @@ -628,6 +628,49 @@ int mapif_parse_RegistryRequest(int fd) return 1; } +static void mapif_namechange_ack(int fd, int account_id, int char_id, int type, int flag, char *name){ + WFIFOHEAD(fd, NAME_LENGTH+13); + WFIFOW(fd, 0) =0x3806; + WFIFOL(fd, 2) =account_id; + WFIFOL(fd, 6) =char_id; + WFIFOB(fd,10) =type; + WFIFOB(fd,11) =flag; + memcpy(WFIFOP(fd, 12), name, NAME_LENGTH); + WFIFOSET(fd, NAME_LENGTH+13); +} + +int mapif_parse_NameChangeRequest(int fd) +{ + RFIFOHEAD(fd); + int account_id = RFIFOL(fd, 2); + int char_id = RFIFOL(fd, 6); + int type = RFIFOB(fd, 10); + char *name =RFIFOP(fd, 11); + int i; + + // Check Authorised letters/symbols in the name + if (char_name_option == 1) { // only letters/symbols in char_name_letters are authorised + for (i = 0; i < NAME_LENGTH && name[i]; i++) + if (strchr(char_name_letters, name[i]) == NULL) { + mapif_namechange_ack(fd, account_id, char_id, type, 0, name); + return 0; + } + } else if (char_name_option == 2) { // letters/symbols in char_name_letters are forbidden + for (i = 0; i < NAME_LENGTH && name[i]; i++) + if (strchr(char_name_letters, name[i]) != NULL) { + mapif_namechange_ack(fd, account_id, char_id, type, 0, name); + return 0; + } + } + //TODO: type holds the type of object to rename. + //If it were a player, it needs to have the guild information and db information + //updated here, because changing it on the map won't make it be saved [Skotlex] + + //name allowed. + mapif_namechange_ack(fd, account_id, char_id, type, 1, name); + return 0; +} + //-------------------------------------------------------- // map server からの通信(1パケットのみ解析すること) @@ -657,6 +700,7 @@ int inter_parse_frommap(int fd) { case 0x3003: mapif_parse_WisToGM(fd); break; case 0x3004: mapif_parse_Registry(fd); break; case 0x3005: mapif_parse_RegistryRequest(fd); break; + case 0x3006: mapif_parse_NameChangeRequest(fd); break; default: if (inter_party_parse_frommap(fd)) break; -- cgit v1.2.3-60-g2f50