summaryrefslogtreecommitdiff
path: root/src/map/intif.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/intif.c')
-rw-r--r--src/map/intif.c44
1 files changed, 38 insertions, 6 deletions
diff --git a/src/map/intif.c b/src/map/intif.c
index d26c37d93..8cd66e364 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -21,9 +21,10 @@
#include <string.h>
#include "../common/showmsg.h"
-
-#include "socket.h"
-#include "timer.h"
+#include "../common/socket.h"
+#include "../common/timer.h"
+#include "../common/nullpo.h"
+#include "../common/malloc.h"
#include "map.h"
#include "battle.h"
#include "chrif.h"
@@ -34,8 +35,7 @@
#include "party.h"
#include "guild.h"
#include "pet.h"
-#include "nullpo.h"
-#include "malloc.h"
+#include "atcommand.h"
static const int packet_len_table[]={
-1,-1,27,-1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3800-0x380f
@@ -46,7 +46,7 @@ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3880
+ 11,-1, 7, 3, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3880
};
extern int char_fd; // inter serverのfdはchar_fdを使う
@@ -122,6 +122,20 @@ int intif_delete_petdata(int pet_id)
return 0;
}
+int intif_rename_pet(struct map_session_data *sd,char *name)
+{
+ if (CheckForCharServer())
+ return 1;
+
+ WFIFOHEAD(inter_fd,NAME_LENGTH+11);
+ WFIFOW(inter_fd,0) = 0x3084;
+ 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);
+ return 0;
+}
+
// GMメッセージを送信
int intif_GMmessage(char* mes,int len,int flag)
@@ -1349,6 +1363,23 @@ int intif_parse_DeletePetOk(int fd)
return 0;
}
+
+int intif_parse_RenamePetOk(int fd)
+{
+ RFIFOHEAD(fd);
+ struct map_session_data *sd;
+ 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;
+ }
+ pet_change_name(sd, RFIFOP(fd,11),1);
+ return 0;
+}
+
//-----------------------------------------------------------------
// inter serverからの通信
// エラーがあれば0(false)を返すこと
@@ -1423,6 +1454,7 @@ 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;
default:
if(battle_config.error_log)
ShowError("intif_parse : unknown packet %d %x\n",fd,RFIFOW(fd,0));