summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog-Trunk.txt4
-rw-r--r--conf-tmpl/Changelog.txt3
-rw-r--r--conf-tmpl/battle/homunc.conf3
-rw-r--r--conf-tmpl/msg_athena.conf2
-rw-r--r--src/char/int_pet.c41
-rw-r--r--src/char/inter.c48
-rw-r--r--src/char_sql/int_pet.c42
-rw-r--r--src/char_sql/inter.c50
-rw-r--r--src/map/battle.c8
-rw-r--r--src/map/battle.h1
-rw-r--r--src/map/clif.c19
-rw-r--r--src/map/intif.c36
-rw-r--r--src/map/intif.h7
-rw-r--r--src/map/mercenary.c35
-rw-r--r--src/map/mercenary.h2
-rw-r--r--src/map/pet.c24
-rw-r--r--src/map/pet.h3
17 files changed, 194 insertions, 134 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index ef2a278a5..f058c28e3 100644
--- a/Changelog-Trunk.txt
+++ b/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/01/26
+ * 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.
* Fixed the normalizing function not sending first classes back to novice
if they do not have basic skill maxed.
* Added a wrapper to delete_timer so it prints out from where the
diff --git a/conf-tmpl/Changelog.txt b/conf-tmpl/Changelog.txt
index 6f6fbb26a..0426710db 100644
--- a/conf-tmpl/Changelog.txt
+++ b/conf-tmpl/Changelog.txt
@@ -1,5 +1,8 @@
Date Added
+2007/01/26
+ * Added battle config hom_rename (homunc.txt) to enable renaming the
+ homunculus multiple times. Defaults to no.
2007/01/22
* Moved the homunculus setting from pet.conf to homunc.conf [Skotlex]
2007/01/12
diff --git a/conf-tmpl/battle/homunc.conf b/conf-tmpl/battle/homunc.conf
index dca92526b..f5e48281f 100644
--- a/conf-tmpl/battle/homunc.conf
+++ b/conf-tmpl/battle/homunc.conf
@@ -43,6 +43,9 @@ hom_setting: 0xFFFF
// The rate a homunculus will get friendly by feeding it. (Note 2)
homunculus_friendly_rate: 100
+// Can you name a homunculus more then once? (Note 1)
+hom_rename: no
+
// Intimacy needed to use Evolved Vanilmirth's Bio Explosion
hvan_explosion_intimate: 45000
diff --git a/conf-tmpl/msg_athena.conf b/conf-tmpl/msg_athena.conf
index 64356e673..04564fd69 100644
--- a/conf-tmpl/msg_athena.conf
+++ b/conf-tmpl/msg_athena.conf
@@ -294,7 +294,7 @@
277: Usage: @request <petition/message to online GMs>.
278: (@request): %s
279: @request sent.
-280: Invalid pet name.
+280: Invalid name.
281: You can't create chat rooms on this map
//Party-related
282: You need to be a party leader to use this command.
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;
diff --git a/src/char_sql/int_pet.c b/src/char_sql/int_pet.c
index ff4f0edb9..1b87de654 100644
--- a/src/char_sql/int_pet.c
+++ b/src/char_sql/int_pet.c
@@ -200,19 +200,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){
@@ -303,28 +290,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);
mapif_create_pet(fd, RFIFOL(fd, 2), RFIFOL(fd, 6), RFIFOW(fd, 10), RFIFOW(fd, 12), RFIFOW(fd, 14), RFIFOW(fd, 16), RFIFOW(fd, 18),
@@ -350,12 +315,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;
-}
-
int inter_pet_parse_frommap(int fd){
RFIFOHEAD(fd);
switch(RFIFOW(fd, 0)){
@@ -363,7 +322,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_sql/inter.c b/src/char_sql/inter.c
index c7e4c7168..b4bc3ddc0 100644
--- a/src/char_sql/inter.c
+++ b/src/char_sql/inter.c
@@ -65,7 +65,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
@@ -73,12 +73,12 @@ 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]
};
struct WisData {
- int id, fd, count,len;
+ int id, fd, count, len;
unsigned long tick;
unsigned char src[24], dst[24], msg[512];
};
@@ -760,6 +760,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;
+}
+
//--------------------------------------------------------
int inter_parse_frommap(int fd)
{
@@ -786,6 +829,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;
diff --git a/src/map/battle.c b/src/map/battle.c
index 4da1c4c2f..f0e0dfb2c 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -3801,6 +3801,7 @@ static const struct battle_data_short {
{ "override_mob_names", &battle_config.override_mob_names },
{ "min_chat_delay", &battle_config.min_chat_delay },
{ "friend_auto_add", &battle_config.friend_auto_add },
+ { "hom_rename", &battle_config.hom_rename },
{ "homunculus_show_growth", &battle_config.homunculus_show_growth }, //[orn]
{ "homunculus_friendly_rate", &battle_config.homunculus_friendly_rate },
};
@@ -4048,10 +4049,10 @@ void battle_set_defaults() {
battle_config.pc_cloak_check_type = 1;
battle_config.monster_cloak_check_type = 0;
battle_config.estimation_type = 3;
- battle_config.gvg_short_damage_rate = 100;
- battle_config.gvg_long_damage_rate = 75;
+ battle_config.gvg_short_damage_rate = 80;
+ battle_config.gvg_long_damage_rate = 80;
battle_config.gvg_weapon_damage_rate = 60;
- battle_config.gvg_magic_damage_rate = 50;
+ battle_config.gvg_magic_damage_rate = 60;
battle_config.gvg_misc_damage_rate = 60;
battle_config.gvg_flee_penalty = 20;
battle_config.gvg_eliminate_time = 7000;
@@ -4244,6 +4245,7 @@ void battle_set_defaults() {
battle_config.min_chat_delay = 0;
battle_config.friend_auto_add = 1;
battle_config.hvan_explosion_intimate = 45000; //[orn]
+ battle_config.hom_rename=0;
battle_config.homunculus_show_growth = 0; //[orn]
battle_config.homunculus_friendly_rate = 100;
}
diff --git a/src/map/battle.h b/src/map/battle.h
index c38e9b20b..adec20e43 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -441,6 +441,7 @@ extern struct Battle_Config {
unsigned short min_chat_delay; //Minimum time between client messages. [Skotlex]
unsigned short friend_auto_add; //When accepting friends, both get friended. [Skotlex]
unsigned int hvan_explosion_intimate ; // fix [albator]
+ unsigned short hom_rename;
unsigned short homunculus_show_growth ; //[orn]
unsigned short homunculus_friendly_rate;
} battle_config;
diff --git a/src/map/clif.c b/src/map/clif.c
index 446f549d4..4ca568318 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -1379,7 +1379,7 @@ int clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag)
WBUFW(buf,0)=0x22e;
memcpy(WBUFP(buf,2),hd->homunculus.name,NAME_LENGTH);
// Bit field, bit 0 : rename_flag (1 = already renamed), bit 1 : homunc vaporized (1 = true), bit 2 : homunc dead (1 = true)
- WBUFB(buf,26)=hd->homunculus.rename_flag | (hd->homunculus.vaporize << 1) | (hd->homunculus.hp?0:4);
+ WBUFB(buf,26)=(battle_config.hom_rename?0:hd->homunculus.rename_flag) | (hd->homunculus.vaporize << 1) | (hd->homunculus.hp?0:4);
WBUFW(buf,27)=hd->homunculus.level;
WBUFW(buf,29)=hd->homunculus.hunger;
WBUFW(buf,31)=(unsigned short) (hd->homunculus.intimacy / 100) ;
@@ -1481,18 +1481,9 @@ void clif_homskillup(struct map_session_data *sd, int skill_num) { //[orn]
return;
}
-void clif_parse_ChangeHomunculusName(int fd, struct map_session_data *sd) { //[orn]
- struct homun_data *hd;
+void clif_parse_ChangeHomunculusName(int fd, struct map_session_data *sd) {
RFIFOHEAD(fd);
- nullpo_retv(sd);
-
- if((hd=sd->hd) == NULL)
- return;
-
- memcpy(hd->homunculus.name,RFIFOP(fd,2),24);
- hd->homunculus.rename_flag = 1;
- clif_hominfo(sd,hd,0);
- clif_charnameack(sd->fd,&hd->bl);
+ merc_hom_change_name(sd,RFIFOP(fd,2));
}
void clif_parse_HomMoveToMaster(int fd, struct map_session_data *sd) { //[orn]
@@ -6264,7 +6255,7 @@ int clif_send_petstatus(struct map_session_data *sd)
WFIFOHEAD(fd,packet_len(0x1a2));
WFIFOW(fd,0)=0x1a2;
memcpy(WFIFOP(fd,2),pet->name,NAME_LENGTH);
- WFIFOB(fd,26)=(battle_config.pet_rename == 1)? 0:pet->rename_flag;
+ WFIFOB(fd,26)=battle_config.pet_rename?0:pet->rename_flag;
WFIFOW(fd,27)=pet->level;
WFIFOW(fd,29)=pet->hungry;
WFIFOW(fd,31)=pet->intimate;
@@ -10832,7 +10823,7 @@ void clif_parse_SendEmotion(int fd, struct map_session_data *sd) {
void clif_parse_ChangePetName(int fd, struct map_session_data *sd) {
RFIFOHEAD(fd);
- pet_change_name(sd,(char*)RFIFOP(fd,2), 0);
+ pet_change_name(sd,(char*)RFIFOP(fd,2));
}
// Kick (right click menu for GM "(name) force to quit")
diff --git a/src/map/intif.c b/src/map/intif.c
index 18a6cc81b..6d49d434d 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -27,7 +27,7 @@
#include "mercenary.h" //albator
static const int packet_len_table[]={
- -1,-1,27,-1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3800-0x380f
+ -1,-1,27,-1, -1, 0,37, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3800-0x380f
-1, 7, 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
@@ -35,8 +35,8 @@ static const int packet_len_table[]={
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,
- 11,-1, 7, 3, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3880
- -1,-1, 7, 3, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3890 Homunculus [albator]
+ 11,-1, 7, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3880
+ -1,-1, 7, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3890 Homunculus [albator]
};
extern int char_fd; // inter serverのfdはchar_fdを使う
@@ -112,21 +112,22 @@ int intif_delete_petdata(int pet_id)
return 1;
}
-int intif_rename_pet(struct map_session_data *sd,char *name)
+
+int intif_rename(struct map_session_data *sd, int type, char *name)
{
if (CheckForCharServer())
return 1;
WFIFOHEAD(inter_fd,NAME_LENGTH+11);
- WFIFOW(inter_fd,0) = 0x3084;
+ WFIFOW(inter_fd,0) = 0x3006;
WFIFOL(inter_fd,2) = sd->status.account_id;
WFIFOL(inter_fd,6) = sd->status.char_id;
- memcpy(WFIFOP(inter_fd,10),name, NAME_LENGTH);
- WFIFOSET(inter_fd,NAME_LENGTH+11);
+ WFIFOB(inter_fd,10) = type; //Type: 0 - PC, 1 - PET, 2 - HOM
+ memcpy(WFIFOP(inter_fd,11),name, NAME_LENGTH);
+ WFIFOSET(inter_fd,NAME_LENGTH+12);
return 0;
}
-
// GMメッセージを送信
int intif_GMmessage(char* mes,int len,int flag)
{
@@ -1414,19 +1415,24 @@ int intif_parse_DeletePetOk(int fd)
return 0;
}
-int intif_parse_RenamePetOk(int fd)
+int intif_parse_ChangeNameOk(int fd)
{
struct map_session_data *sd = NULL;
RFIFOHEAD(fd);
if((sd=map_id2sd(RFIFOL(fd,2)))==NULL ||
sd->status.char_id != RFIFOL(fd,6))
return 0;
- if (RFIFOB(fd,10) == 0) {
- clif_displaymessage(sd->fd, msg_txt(280)); // You cannot use this name for your pet.
- clif_send_petstatus(sd); //Send status so client knows oet name change got rejected.
- return 0;
+
+ switch (RFIFOB(fd,10)) {
+ case 0: //Players [NOT SUPPORTED YET]
+ break;
+ case 1: //Pets
+ pet_change_name_ack(sd, RFIFOP(fd,12), RFIFOB(fd,11));
+ break;
+ case 2: //Hom
+ merc_hom_change_name_ack(sd, RFIFOP(fd,12), RFIFOB(fd,11));
+ break;
}
- pet_change_name(sd, RFIFOP(fd,11),1);
return 0;
}
@@ -1523,6 +1529,7 @@ int intif_parse(int fd)
case 0x3802: intif_parse_WisEnd(fd); break;
case 0x3803: mapif_parse_WisToGM(fd); break;
case 0x3804: intif_parse_Registers(fd); break;
+ case 0x3806: intif_parse_ChangeNameOk(fd); break;
case 0x3810: intif_parse_LoadStorage(fd); break;
case 0x3811: intif_parse_SaveStorage(fd); break;
case 0x3818: intif_parse_LoadGuildStorage(fd); break;
@@ -1557,7 +1564,6 @@ int intif_parse(int fd)
case 0x3881: intif_parse_RecvPetData(fd); break;
case 0x3882: intif_parse_SavePetOk(fd); break;
case 0x3883: intif_parse_DeletePetOk(fd); break;
- case 0x3884: intif_parse_RenamePetOk(fd); break;
case 0x3890: intif_parse_CreateHomunculus(fd); break;
case 0x3891: intif_parse_RecvHomunculusData(fd); break;
case 0x3892: intif_parse_SaveHomunculusOk(fd); break;
diff --git a/src/map/intif.h b/src/map/intif.h
index 86f09e30e..56f2f4783 100644
--- a/src/map/intif.h
+++ b/src/map/intif.h
@@ -58,9 +58,10 @@ int intif_create_pet(int account_id, int char_id, short pet_type, short pet_lv,
int intif_request_petdata(int account_id, int char_id, int pet_id);
int intif_save_petdata(int account_id, struct s_pet *p);
int intif_delete_petdata(int pet_id);
-int intif_rename_pet(struct map_session_data *sd, char *name);
-
-
+int intif_rename(struct map_session_data *sd, int type, char *name);
+#define intif_rename_pc(sd, name) intif_rename(sd, 0, name)
+#define intif_rename_pet(sd, name) intif_rename(sd, 1, name)
+#define intif_rename_hom(sd, name) intif_rename(sd, 2, name)
int intif_homunculus_create(int account_id, struct s_homunculus *sh);
int intif_homunculus_requestload(int account_id, int homun_id);
int intif_homunculus_requestsave(int account_id, struct s_homunculus* sh);
diff --git a/src/map/mercenary.c b/src/map/mercenary.c
index 6cd05926b..cb502d8af 100644
--- a/src/map/mercenary.c
+++ b/src/map/mercenary.c
@@ -494,6 +494,41 @@ int merc_hom_hungry_timer_delete(struct homun_data *hd)
return 1;
}
+int merc_hom_change_name(struct map_session_data *sd,char *name)
+{
+ int i;
+ struct homun_data *hd;
+ nullpo_retr(1, sd);
+
+ hd = sd->hd;
+ if (!merc_is_hom_active(hd))
+ return 1;
+ if(hd->homunculus.rename_flag && !battle_config.hom_rename)
+ return 1;
+
+ for(i=0;i<NAME_LENGTH && name[i];i++){
+ if( !(name[i]&0xe0) || name[i]==0x7f)
+ return 1;
+ }
+
+ return intif_rename_hom(sd, name);
+}
+
+int merc_hom_change_name_ack(struct map_session_data *sd, char* name, int flag)
+{
+ struct homun_data *hd = sd->hd;
+ if (!merc_is_hom_active(hd)) return 0;
+ if (!flag) {
+ clif_displaymessage(sd->fd, msg_txt(280)); // You cannot use this name
+ return 0;
+ }
+ strncpy(hd->homunculus.name,name,NAME_LENGTH);
+ clif_charnameack (0,&hd->bl);
+ hd->homunculus.rename_flag = 1;
+ clif_hominfo(sd,hd,0);
+ return 1;
+}
+
int search_homunculusDB_index(int key,int type)
{
int i;
diff --git a/src/map/mercenary.h b/src/map/mercenary.h
index 6a56b20a5..e5e194967 100644
--- a/src/map/mercenary.h
+++ b/src/map/mercenary.h
@@ -71,6 +71,8 @@ int search_homunculusDB_index(int key,int type);
int merc_menu(struct map_session_data *sd,int menunum);
int merc_hom_food(struct map_session_data *sd, struct homun_data *hd);
int merc_hom_hungry_timer_delete(struct homun_data *hd);
+int merc_hom_change_name(struct map_session_data *sd,char *name);
+int merc_hom_change_name_ack(struct map_session_data *sd, char* name, int flag);
#define merc_stop_walking(hd, type) { if((hd)->ud.walktimer != -1) unit_stop_walking(&(hd)->bl, type); }
#define merc_stop_attack(hd) { if((hd)->ud.attacktimer != -1) unit_stop_attack(&(hd)->bl); hd->ud.target = 0; }
int merc_hom_increase_intimacy(struct homun_data * hd, unsigned int value);
diff --git a/src/map/pet.c b/src/map/pet.c
index cf62696a6..fd65f9565 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -26,6 +26,7 @@
#include "script.h"
#include "skill.h"
#include "unit.h"
+#include "atcommand.h"
#define MIN_PETTHINKTIME 100
@@ -683,7 +684,7 @@ int pet_menu(struct map_session_data *sd,int menunum)
return 0;
}
-int pet_change_name(struct map_session_data *sd,char *name, int flag) //flag 0 = check name, 1 = good name
+int pet_change_name(struct map_session_data *sd,char *name)
{
int i;
struct pet_data *pd;
@@ -698,19 +699,24 @@ int pet_change_name(struct map_session_data *sd,char *name, int flag) //flag 0 =
return 1;
}
- if (!flag)
- return intif_rename_pet(sd, name);
-
- pet_stop_walking(pd,1);
-
- memcpy(pd->pet.name, name, NAME_LENGTH-1);
+ return intif_rename_pet(sd, name);
+}
+int pet_change_name_ack(struct map_session_data *sd, char* name, int flag)
+{
+ struct pet_data *pd = sd->pd;
+ if (!pd) return 0;
+ if (!flag) {
+ clif_displaymessage(sd->fd, msg_txt(280)); // You cannot use this name for your pet.
+ clif_send_petstatus(sd); //Send status so client knows oet name change got rejected.
+ return 0;
+ }
+ memcpy(pd->pet.name, name, NAME_LENGTH-1);
clif_charnameack (0,&pd->bl);
pd->pet.rename_flag = 1;
clif_pet_equip(pd);
clif_send_petstatus(sd);
-
- return 0;
+ return 1;
}
int pet_equipitem(struct map_session_data *sd,int index)
diff --git a/src/map/pet.h b/src/map/pet.h
index 71c1684e5..3bb6d0906 100644
--- a/src/map/pet.h
+++ b/src/map/pet.h
@@ -48,7 +48,8 @@ int pet_catch_process1(struct map_session_data *sd,int target_class);
int pet_catch_process2(struct map_session_data *sd,int target_id);
int pet_get_egg(int account_id,int pet_id,int flag);
int pet_menu(struct map_session_data *sd,int menunum);
-int pet_change_name(struct map_session_data *sd,char *name,int flag); //flag 0 = check name, 1 = good name
+int pet_change_name(struct map_session_data *sd,char *name);
+int pet_change_name_ack(struct map_session_data *sd, char* name, int flag);
int pet_equipitem(struct map_session_data *sd,int index);
int pet_lootitem_drop(struct pet_data *pd,struct map_session_data *sd);
int pet_attackskill(struct pet_data *pd, int target_id);