summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-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
9 files changed, 90 insertions, 45 deletions
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);