summaryrefslogtreecommitdiff
path: root/src/map/intif.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-06-16 03:05:29 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-06-16 03:05:29 +0000
commitbc2b385a1898407fe5978b66c0f795b8235d52cd (patch)
treeaea92c868a2e9de37045cfae8627f723e1d50a4e /src/map/intif.c
parent2152f7e6123dabf84f622a53ab43bb63003a2549 (diff)
downloadhercules-bc2b385a1898407fe5978b66c0f795b8235d52cd.tar.gz
hercules-bc2b385a1898407fe5978b66c0f795b8235d52cd.tar.bz2
hercules-bc2b385a1898407fe5978b66c0f795b8235d52cd.tar.xz
hercules-bc2b385a1898407fe5978b66c0f795b8235d52cd.zip
- Merged Adam's patch to let the char-server handle validation of pet-name-change requests through the allowed char letters config.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7192 54d463be-8e91-2dee-dedb-b68131a5f0ec
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));