diff options
author | flaviojs <flaviojs@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2011-10-09 13:19:06 +0000 |
---|---|---|
committer | flaviojs <flaviojs@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2011-10-09 13:19:06 +0000 |
commit | a8ee3c14340344c50c34514520c165aa283e91e0 (patch) | |
tree | 2602ffcb2197395e3bd14004a6504093a20c5a6e /src/char_sql | |
parent | 5e97766aa1488444f53f55e4a08569da6f88c726 (diff) | |
download | hercules-a8ee3c14340344c50c34514520c165aa283e91e0.tar.gz hercules-a8ee3c14340344c50c34514520c165aa283e91e0.tar.bz2 hercules-a8ee3c14340344c50c34514520c165aa283e91e0.tar.xz hercules-a8ee3c14340344c50c34514520c165aa283e91e0.zip |
* Rework some party code.
- add leader argument to party_fill_member
- add party_getmemberid
- add requester char_id to packets 0x3021 and 0x3821 (party info)
- diff members when replacing party info
- remove fixup all-player-iteration when receiving a party for the first time
- send 'party info' before 'party created'
- send 'party info' before 'party member added'
- update empty party_id when checking the player of a party
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14968 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/char_sql')
-rw-r--r-- | src/char_sql/int_party.c | 43 | ||||
-rw-r--r-- | src/char_sql/inter.c | 2 |
2 files changed, 22 insertions, 23 deletions
diff --git a/src/char_sql/int_party.c b/src/char_sql/int_party.c index 07dbcdb7d..88c352b44 100644 --- a/src/char_sql/int_party.c +++ b/src/char_sql/int_party.c @@ -357,29 +357,29 @@ int mapif_party_created(int fd,int account_id,int char_id,struct party *p) } // パーティ情報見つからず -int mapif_party_noinfo(int fd,int party_id) +static void mapif_party_noinfo(int fd, int party_id, int char_id) { - WFIFOHEAD(fd,8); - WFIFOW(fd,0)=0x3821; - WFIFOW(fd,2)=8; - WFIFOL(fd,4)=party_id; - WFIFOSET(fd,8); - ShowWarning("int_party: info not found %d\n",party_id); - return 0; + WFIFOHEAD(fd, 12); + WFIFOW(fd,0) = 0x3821; + WFIFOW(fd,2) = 12; + WFIFOL(fd,4) = char_id; + WFIFOL(fd,8) = party_id; + WFIFOSET(fd,12); + ShowWarning("int_party: info not found (party_id=%d char_id=%d)\n", party_id, char_id); } // パーティ情報まとめ送り -int mapif_party_info(int fd,struct party *p) +static void mapif_party_info(int fd, struct party* p, int char_id) { - unsigned char buf[5+sizeof(struct party)]; - WBUFW(buf,0)=0x3821; - WBUFW(buf,2)=4+sizeof(struct party); - memcpy(buf+4,p,sizeof(struct party)); + unsigned char buf[8 + sizeof(struct party)]; + WBUFW(buf,0) = 0x3821; + WBUFW(buf,2) = 8 + sizeof(struct party); + WBUFL(buf,4) = char_id; + memcpy(WBUFP(buf,8), p, sizeof(struct party)); if(fd<0) mapif_sendall(buf,WBUFW(buf,2)); else mapif_send(fd,buf,WBUFW(buf,2)); - return 0; } // パーティメンバ追加可否 int mapif_party_memberadded(int fd, int party_id, int account_id, int char_id, int flag) { @@ -506,8 +506,8 @@ int mapif_parse_CreateParty(int fd, char *name, int item, int item2, struct part //Add party to db int_party_calc_state(p); idb_put(party_db_, p->party.party_id, p); + mapif_party_info(fd, &p->party, 0); mapif_party_created(fd,leader->account_id,leader->char_id,&p->party); - mapif_party_info(fd,&p->party); } else { //Failed to create party. aFree(p); mapif_party_created(fd,leader->account_id,leader->char_id,NULL); @@ -516,16 +516,15 @@ int mapif_parse_CreateParty(int fd, char *name, int item, int item2, struct part return 0; } // パーティ情報要求 -int mapif_parse_PartyInfo(int fd,int party_id) +static void mapif_parse_PartyInfo(int fd, int party_id, int char_id) { struct party_data *p; p = inter_party_fromsql(party_id); if (p) - mapif_party_info(fd,&p->party); + mapif_party_info(fd, &p->party, char_id); else - mapif_party_noinfo(fd,party_id); - return 0; + mapif_party_noinfo(fd, party_id, char_id); } // パーティ追加要求 int mapif_parse_PartyAddMember(int fd, int party_id, struct party_member *member) @@ -558,8 +557,8 @@ int mapif_parse_PartyAddMember(int fd, int party_id, struct party_member *member int_party_check_lv(p); } + mapif_party_info(-1, &p->party, 0); mapif_party_memberadded(fd, party_id, member->account_id, member->char_id, 0); - mapif_party_info(-1, &p->party); inter_party_tosql(&p->party, PS_ADDMEMBER, i); return 0; @@ -633,7 +632,7 @@ int mapif_parse_PartyLeave(int fd, int party_id, int account_id, int char_id) } if (party_check_empty(p) == 0) - mapif_party_info(-1,&p->party); + mapif_party_info(-1, &p->party, 0); return 0; } // When member goes to other map or levels up. @@ -746,7 +745,7 @@ int inter_party_parse_frommap(int fd) RFIFOHEAD(fd); switch(RFIFOW(fd,0)) { case 0x3020: mapif_parse_CreateParty(fd, (char*)RFIFOP(fd,4), RFIFOB(fd,28), RFIFOB(fd,29), (struct party_member*)RFIFOP(fd,30)); break; - case 0x3021: mapif_parse_PartyInfo(fd, RFIFOL(fd,2)); break; + case 0x3021: mapif_parse_PartyInfo(fd, RFIFOL(fd,2), RFIFOL(fd,6)); break; case 0x3022: mapif_parse_PartyAddMember(fd, RFIFOL(fd,4), (struct party_member*)RFIFOP(fd,8)); break; case 0x3023: mapif_parse_PartyChangeOption(fd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOW(fd,10), RFIFOW(fd,12)); break; case 0x3024: mapif_parse_PartyLeave(fd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)); break; diff --git a/src/char_sql/inter.c b/src/char_sql/inter.c index 97c48bdf1..68a2f7871 100644 --- a/src/char_sql/inter.c +++ b/src/char_sql/inter.c @@ -47,7 +47,7 @@ char main_chat_nick[16] = "Main"; int inter_recv_packet_length[] = { -1,-1, 7,-1, -1,13,36, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 3000- 6,-1, 0, 0, 0, 0, 0, 0, 10,-1, 0, 0, 0, 0, 0, 0, // 3010- - -1, 6,-1,14, 14,19, 6,-1, 14,14, 0, 0, 0, 0, 0, 0, // 3020- + -1,10,-1,14, 14,19, 6,-1, 14,14, 0, 0, 0, 0, 0, 0, // 3020- Party -1, 6,-1,-1, 55,19, 6,-1, 14,-1,-1,-1, 18,19,186,-1, // 3030- 5, 9, 0, 0, 0, 0, 0, 0, 7, 6,10,10, 10,-1, 0, 0, // 3040- -1,-1,10,10, 0,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 3050- Auction System [Zephyrus] |