summaryrefslogtreecommitdiff
path: root/src/char
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/char
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/char')
-rw-r--r--src/char/int_homun.c52
-rw-r--r--src/char/inter.c2
2 files changed, 13 insertions, 41 deletions
diff --git a/src/char/int_homun.c b/src/char/int_homun.c
index 886c56f06..c71cd7792 100644
--- a/src/char/int_homun.c
+++ b/src/char/int_homun.c
@@ -183,20 +183,15 @@ int inter_homun_delete(int hom_id)
return 1;
}
-int mapif_homun_created(int fd,int account_id, int char_id, struct s_homunculus *p)
+int mapif_homun_created(int fd,int account_id, struct s_homunculus *p)
{
+ WFIFOHEAD(fd, sizeof(struct s_homunculus)+9);
WFIFOW(fd, 0) =0x3890;
- WFIFOL(fd,2) = account_id;
- WFIFOL(fd,6) = char_id;
- if(p){
- WFIFOW(fd,10)=1;
- WFIFOL(fd,12)=p->hom_id;
- } else{
- WFIFOW(fd,10)=0;
- WFIFOL(fd,12)=0;
- }
- WFIFOSET(fd, 16);
-
+ WFIFOW(fd,2) = sizeof(struct s_homunculus)+9;
+ WFIFOL(fd,4) = account_id;
+ WFIFOB(fd,8)= p->hom_id?1:0;
+ memcpy(WFIFOP(fd,9), p, sizeof(struct s_homunculus));
+ WFIFOSET(fd, WFIFOW(fd,2));
return 0;
}
@@ -259,40 +254,17 @@ int mapif_rename_homun_ack(int fd, int account_id, int char_id, int flag, char *
int mapif_create_homun(int fd)
{
struct s_homunculus *p;
- int account_id = RFIFOL(fd,2);
- int char_id = RFIFOL(fd,6);
p= (struct s_homunculus *) aCalloc(sizeof(struct s_homunculus), 1);
if(p==NULL){
ShowFatalError("int_homun: out of memory !\n");
- mapif_homun_created(fd,account_id,char_id,NULL);
+ //Sending the received data will pass hom_id == 0 <- fail.
+ mapif_homun_created(fd,RFIFOL(fd,4),(struct s_homunculus*)RFIFOP(fd,8));
return 0;
}
- /* Data from packet */
- p->char_id = char_id;
- p->class_ = RFIFOW(fd,10);
- p->max_hp = RFIFOL(fd,12);
- p->max_sp = RFIFOL(fd,16);
- memcpy(p->name, (char*)RFIFOP(fd, 20), NAME_LENGTH-1);
- p->str = RFIFOL(fd,44);
- p->agi = RFIFOL(fd,48);
- p->vit = RFIFOL(fd,52);
- p->int_ = RFIFOL(fd,56);
- p->dex = RFIFOL(fd,60);
- p->luk = RFIFOL(fd,64);
-
- /* Const data for each creation*/
- p->hom_id = homun_newid++;
- p->exp = 0;
- p->hp = 10 ;
- p->sp = 0 ;
- p->rename_flag = 0;
- p->skillpts =0;
- p->hunger = 32;
- p->level=1;
- p->intimacy = 21;
-
+ memcpy(p, RFIFOP(fd,8), sizeof(struct s_homunculus));
+ p->hom_id = homun_newid++; //New ID
idb_put(homun_db,p->hom_id,p);
- mapif_homun_created(fd,account_id,char_id,p);
+ mapif_homun_created(fd,RFIFOL(fd,4),p);
return 0;
}
diff --git a/src/char/inter.c b/src/char/inter.c
index 17b8ddc56..74ea3a956 100644
--- a/src/char/inter.c
+++ b/src/char/inter.c
@@ -58,7 +58,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,
48,14,-1, 6, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3080-0x308f
- 68,10,-1, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x3090 - 0x309f Homunculus packets [albator]
+ -1,10,-1, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x3090 - 0x309f Homunculus packets [albator]
};
struct WisData {