summaryrefslogtreecommitdiff
path: root/src/map/intif.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-10-20 18:30:05 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-10-20 18:30:05 +0000
commit54a7f124543239c98d696da37c91eb5e2e99b25d (patch)
tree03c1c0d7148de31a112f2c3d82c7eabf910dd351 /src/map/intif.c
parent1893d0bc7b07a362ac6efcd8de4af056544bad3a (diff)
downloadhercules-54a7f124543239c98d696da37c91eb5e2e99b25d.tar.gz
hercules-54a7f124543239c98d696da37c91eb5e2e99b25d.tar.bz2
hercules-54a7f124543239c98d696da37c91eb5e2e99b25d.tar.xz
hercules-54a7f124543239c98d696da37c91eb5e2e99b25d.zip
- Fixed Charge Atk being able to go through chasm/pits.
- Moved the homunculus DB information from the player structure to the homun structure. Modified the homunculus creation packets to hold this information during creation, also, all initial values are handled by the map-server, the char server only assigns it a homun ID. - Removed target_id/attacked_id from homun_data as it wasn't really used. - Codes cleanup (removing of commented code mostly) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9031 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/intif.c')
-rw-r--r--src/map/intif.c63
1 files changed, 19 insertions, 44 deletions
diff --git a/src/map/intif.c b/src/map/intif.c
index 6dc5f15cd..bab76b40b 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -36,7 +36,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,
11,-1, 7, 3, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3880
- 16,-1, 7, 3, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3890 Homunculus [albator]
+ -1,-1, 7, 3, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3890 Homunculus [albator]
};
extern int char_fd; // inter serverのfdはchar_fdを使う
@@ -786,22 +786,12 @@ int intif_homunculus_create(int account_id, struct s_homunculus *sh)
{
if (CheckForCharServer())
return 0;
- WFIFOHEAD(inter_fd, 44+NAME_LENGHT);
- WFIFOW(inter_fd, 0) = 0x3090;
- WFIFOL(inter_fd, 2) = account_id;
- WFIFOL(inter_fd, 6) = sh->char_id;
- WFIFOW(inter_fd, 10) = sh->class_;
- WFIFOL(inter_fd,12) = sh->max_hp;
- WFIFOL(inter_fd,16) = sh->max_sp;
- memcpy(WFIFOP(inter_fd,20), sh->name, NAME_LENGTH);
- WFIFOL(inter_fd,44) = sh->str;
- WFIFOL(inter_fd,48) = sh->agi;
- WFIFOL(inter_fd,52) = sh->vit;
- WFIFOL(inter_fd,56) = sh->int_;
- WFIFOL(inter_fd,60) = sh->dex;
- WFIFOL(inter_fd,64) = sh->luk;
- WFIFOSET(inter_fd, 44+NAME_LENGTH);
-
+ WFIFOHEAD(inter_fd, sizeof(struct s_homunculus)+8);
+ WFIFOW(inter_fd,0) = 0x3090;
+ WFIFOW(inter_fd,2) = sizeof(struct s_homunculus)+8;
+ WFIFOL(inter_fd,4) = account_id;
+ memcpy(WFIFOP(inter_fd,8),sh,sizeof(struct s_homunculus));
+ WFIFOSET(inter_fd, WFIFOW(inter_fd,2));
return 0;
}
@@ -814,7 +804,7 @@ int intif_homunculus_requestload(int account_id, int homun_id)
WFIFOL(inter_fd,2) = account_id;
WFIFOL(inter_fd,6) = homun_id;
WFIFOSET(inter_fd, 10);
- return 0;
+ return 1;
}
int intif_homunculus_requestsave(int account_id, struct s_homunculus* sh)
@@ -1446,47 +1436,32 @@ int intif_parse_RenamePetOk(int fd)
int intif_parse_CreateHomunculus(int fd)
{
- struct map_session_data *sd = NULL;
+ int len;
RFIFOHEAD(fd);
-
- if((sd=map_id2sd(RFIFOL(fd,2)))==NULL ||
- sd->status.char_id != RFIFOL(fd,6))
+ len=RFIFOW(fd,2)-9;
+ if(sizeof(struct s_homunculus)!=len) {
+ if(battle_config.etc_log)
+ ShowError("intif: create homun data: data size error %d != %d\n",sizeof(struct s_homunculus),len);
return 0;
-
- if(RFIFOW(fd,10)==1)
- {
- ShowInfo("Homunculus created successfully\n");
- sd->status.hom_id = sd->homunculus.hom_id = RFIFOL(fd,12);
- merc_hom_recv_data(RFIFOL(fd,2), &sd->homunculus, 1) ;
- }
- else
- {
- ShowError("intif_parse_CreateHomunculus: failed to create homunculus\n");
- clif_displaymessage(sd->fd, "[debug] fail to create homunculus"); // display error message..
}
-
+ merc_hom_recv_data(RFIFOL(fd,4), (struct s_homunculus*)RFIFOP(fd,9), RFIFOB(fd,8)) ;
return 0;
}
int intif_parse_RecvHomunculusData(int fd)
{
- struct s_homunculus sh;
int len;
RFIFOHEAD(fd);
- len=RFIFOW(fd,2);
+ len=RFIFOW(fd,2)-9;
- if(sizeof(struct s_homunculus)!=len-9) {
+ if(sizeof(struct s_homunculus)!=len) {
if(battle_config.etc_log)
- ShowError("intif: homun data: data size error %d %d\n",sizeof(struct s_homunculus),len-9);
- }
- else{
- memcpy(&sh,RFIFOP(fd,9),sizeof(struct s_homunculus));
- merc_hom_recv_data(RFIFOL(fd,4),&sh,RFIFOB(fd,8));
+ ShowError("intif: homun data: data size error %d %d\n",sizeof(struct s_homunculus),len);
+ return 0;
}
-
+ merc_hom_recv_data(RFIFOL(fd,4), (struct s_homunculus*)RFIFOP(fd,9), RFIFOB(fd,8));
return 0;
-
}
int intif_parse_SaveHomunculusOk(int fd)