summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
author(no author) <(no author)@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-01-28 18:46:43 +0000
committer(no author) <(no author)@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-01-28 18:46:43 +0000
commit9869ec7eebde772ae9d3730a14f4831d4adfc290 (patch)
tree59565129a1915311134c29d387c265bce104858f /src/map
parent99aec0eb822ca12dde4f72b1c3bf4d5597bf0530 (diff)
downloadhercules-9869ec7eebde772ae9d3730a14f4831d4adfc290.tar.gz
hercules-9869ec7eebde772ae9d3730a14f4831d4adfc290.tar.bz2
hercules-9869ec7eebde772ae9d3730a14f4831d4adfc290.tar.xz
hercules-9869ec7eebde772ae9d3730a14f4831d4adfc290.zip
* Added DUMP_ALL_PACKETS and moved dump packets code in clif_parse a bit to support it
* Added base code for Party Item Sharing git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1009 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c2
-rw-r--r--src/map/clif.c51
-rw-r--r--src/map/intif.c6
-rw-r--r--src/map/intif.h2
-rw-r--r--src/map/mob.c86
-rw-r--r--src/map/party.c4
-rw-r--r--src/map/party.h2
7 files changed, 110 insertions, 43 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index ff202a631..a91fe061b 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -5098,7 +5098,7 @@ int atcommand_party(
return -1;
}
- party_create(sd, party);
+ party_create(sd, party, 0, 0);
return 0;
}
diff --git a/src/map/clif.c b/src/map/clif.c
index d0bf86e27..d3b00a306 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -1,6 +1,7 @@
// $Id: clif.c 2200 2004-11-07 11:49:58Z Yor $
#define DUMP_UNKNOWN_PACKET 1
+#define DUMP_ALL_PACKETS 0
#include <stdio.h>
#include <ctype.h>
@@ -9593,7 +9594,7 @@ void clif_parse_CloseKafra(int fd, struct map_session_data *sd) {
*/
void clif_parse_CreateParty(int fd, struct map_session_data *sd) {
if (battle_config.basic_skill_check == 0 || pc_checkskill(sd,NV_BASIC) >= 7) {
- party_create(sd,(char*)RFIFOP(fd,2));
+ party_create(sd,(char*)RFIFOP(fd,2),0,0);
} else
clif_skill_fail(sd,1,0,4);
}
@@ -9604,7 +9605,7 @@ void clif_parse_CreateParty(int fd, struct map_session_data *sd) {
*/
void clif_parse_CreateParty2(int fd, struct map_session_data *sd) {
if (battle_config.basic_skill_check == 0 || pc_checkskill(sd,NV_BASIC) >= 7){
- party_create(sd,(char*)RFIFOP(fd,2));
+ party_create(sd,(char*)RFIFOP(fd,2),RFIFOB(fd,26),RFIFOB(fd,27));
} else
clif_skill_fail(sd,1,0,4);
}
@@ -10504,7 +10505,7 @@ static void (*clif_parse_func_table[MAX_PACKET_DB])(int, struct map_session_data
*------------------------------------------
*/
static int clif_parse(int fd) {
- int packet_len = 0, cmd, packet_ver;
+ int packet_len = 0, cmd, packet_ver, dump = 0;
struct map_session_data *sd;
sd = (struct map_session_data*)session[fd]->session_data;
@@ -10672,6 +10673,10 @@ static int clif_parse(int fd) {
if (RFIFOREST(fd) < packet_len)
return 0; // まだ1パケット分データが揃ってない
+ #if DUMP_ALL_PACKETS
+ dump = 1;
+ #endif
+
if (sd && sd->state.auth == 1 && sd->state.waitingdisconnect == 1) { // 切断待ちの場合パケットを処理しない
} else if (packet_db[packet_ver][cmd].func) { // packet version 5-6-7 use same functions, but size are different
@@ -10680,28 +10685,13 @@ static int clif_parse(int fd) {
} else {
// 不明なパケット
if (battle_config.error_log) {
- if (fd)
- printf("\nclif_parse: session #%d, packet 0x%x, lenght %d\n", fd, cmd, packet_len);
-#ifdef DUMP_UNKNOWN_PACKET
+#if DUMP_UNKNOWN_PACKET
{
int i;
FILE *fp;
char packet_txt[256] = "save/packet.txt";
time_t now;
- printf("---- 00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F");
- for(i = 0; i < packet_len; i++) {
- if ((i & 15) == 0)
- printf("\n%04X ",i);
- printf("%02X ", RFIFOB(fd,i));
- }
- if (sd && sd->state.auth) {
- if (sd->status.name != NULL)
- printf("\nAccount ID %d, character ID %d, player name %s.\n",
- sd->status.account_id, sd->status.char_id, sd->status.name);
- else
- printf("\nAccount ID %d.\n", sd->bl.id);
- } else if (sd) // not authentified! (refused by char-server or disconnect before to be authentified)
- printf("\nAccount ID %d.\n", sd->bl.id);
+ dump = 1;
if ((fp = fopen(packet_txt, "a")) == NULL) {
printf("clif.c: cant write [%s] !!! data is lost !!!\n", packet_txt);
@@ -10730,6 +10720,27 @@ static int clif_parse(int fd) {
#endif
}
}
+
+ if (dump) {
+ int i;
+ if (fd)
+ printf("\nclif_parse: session #%d, packet 0x%x, lenght %d\n", fd, cmd, packet_len);
+ printf("---- 00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F");
+ for(i = 0; i < packet_len; i++) {
+ if ((i & 15) == 0)
+ printf("\n%04X ",i);
+ printf("%02X ", RFIFOB(fd,i));
+ }
+ if (sd && sd->state.auth) {
+ if (sd->status.name != NULL)
+ printf("\nAccount ID %d, character ID %d, player name %s.\n",
+ sd->status.account_id, sd->status.char_id, sd->status.name);
+ else
+ printf("\nAccount ID %d.\n", sd->bl.id);
+ } else if (sd) // not authentified! (refused by char-server or disconnect before to be authentified)
+ printf("\nAccount ID %d.\n", sd->bl.id);
+ }
+
RFIFOSKIP(fd, packet_len);
return 0;
diff --git a/src/map/intif.c b/src/map/intif.c
index 3f1bbfe88..4306838aa 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -273,7 +273,7 @@ int intif_send_guild_storage(int account_id,struct guild_storage *gstor)
}
// パーティ作成要求
-int intif_create_party(struct map_session_data *sd,char *name)
+int intif_create_party(struct map_session_data *sd,char *name,int item,int item2)
{
if (CheckForCharServer())
return 0;
@@ -285,7 +285,9 @@ int intif_create_party(struct map_session_data *sd,char *name)
memcpy(WFIFOP(inter_fd,30),sd->status.name,24);
memcpy(WFIFOP(inter_fd,54),map[sd->bl.m].name,16);
WFIFOW(inter_fd,70)= sd->status.base_level;
- WFIFOSET(inter_fd,72);
+ WFIFOB(inter_fd,72)= item;
+ WFIFOB(inter_fd,73)= item2;
+ WFIFOSET(inter_fd,74);
// if(battle_config.etc_log)
// printf("intif: create party\n");
return 0;
diff --git a/src/map/intif.h b/src/map/intif.h
index 761c1ea63..a27712985 100644
--- a/src/map/intif.h
+++ b/src/map/intif.h
@@ -18,7 +18,7 @@ int intif_request_guild_storage(int account_id, int guild_id);
int intif_send_guild_storage(int account_id, struct guild_storage *gstor);
-int intif_create_party(struct map_session_data *sd,char *name);
+int intif_create_party(struct map_session_data *sd,char *name,int item,int item2);
int intif_request_partyinfo(int party_id);
int intif_party_addmember(int party_id, int account_id);
int intif_party_changeoption(int party_id, int account_id, int exp, int item);
diff --git a/src/map/mob.c b/src/map/mob.c
index 6a2666cf1..ecf3c8bdc 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -1960,7 +1960,7 @@ static int mob_delay_item_drop(int tid,unsigned int tick,int id,int data)
{
struct delay_item_drop *ditem;
struct item temp_item;
- int flag;
+ int flag, drop_flag = 1;
nullpo_retr(0, ditem=(struct delay_item_drop *)id);
@@ -1969,16 +1969,43 @@ static int mob_delay_item_drop(int tid,unsigned int tick,int id,int data)
temp_item.amount = ditem->amount;
temp_item.identify = !itemdb_isequip3(temp_item.nameid);
- if(battle_config.item_auto_get){
- if(ditem->first_sd && (flag = pc_additem(ditem->first_sd,&temp_item,ditem->amount))){
- clif_additem(ditem->first_sd,0,0,flag);
- map_addflooritem(&temp_item,1,ditem->m,ditem->x,ditem->y,ditem->first_sd,ditem->second_sd,ditem->third_sd,0);
+ if (ditem->first_sd){
+ #if 0
+ if (ditem->first_sd->status.party_id > 0){
+ struct party *p;
+ if((p=party_search(ditem->first_sd->status.party_id)) && p->item){
+ struct map_session_data *sd = NULL;
+ int i;
+ for (i = p->itemc + 1; i!=p->itemc; i++) { // initialise counter and loop through the party
+ if (i >= MAX_PARTY)
+ i = 0; // reset counter to 1st person in party so it'll stop when it reaches "itemc"
+ if ((sd=p->member[i].sd)!=NULL && sd->bl.m == ditem->first_sd->bl.m)
+ break;
+ }
+ if (sd){ // if an appropiate party member was found
+ drop_flag = 0;
+ if ((p->itemc++) >= MAX_PARTY)
+ p->itemc = 0;
+ if ((flag = pc_additem(ditem->first_sd,&temp_item,ditem->amount))) {
+ clif_additem(ditem->first_sd,0,0,flag);
+ drop_flag = 1;
+ }
+ }
+ }
+ } else
+ #endif
+ if(battle_config.item_auto_get){
+ drop_flag = 0;
+ if((flag = pc_additem(ditem->first_sd,&temp_item,ditem->amount))){
+ clif_additem(ditem->first_sd,0,0,flag);
+ drop_flag = 1;
+ }
}
- aFree(ditem);
- return 0;
}
- map_addflooritem(&temp_item,1,ditem->m,ditem->x,ditem->y,ditem->first_sd,ditem->second_sd,ditem->third_sd,0);
+ if (drop_flag) {
+ map_addflooritem(&temp_item,1,ditem->m,ditem->x,ditem->y,ditem->first_sd,ditem->second_sd,ditem->third_sd,0);
+ }
aFree(ditem);
return 0;
@@ -1991,20 +2018,47 @@ static int mob_delay_item_drop(int tid,unsigned int tick,int id,int data)
static int mob_delay_item_drop2(int tid,unsigned int tick,int id,int data)
{
struct delay_item_drop2 *ditem;
- int flag;
+ int flag, drop_flag = 1;
nullpo_retr(0, ditem=(struct delay_item_drop2 *)id);
- if(battle_config.item_auto_get){
- if(ditem->first_sd && (flag = pc_additem(ditem->first_sd,&ditem->item_data,ditem->item_data.amount))){
- clif_additem(ditem->first_sd,0,0,flag);
- map_addflooritem(&ditem->item_data,ditem->item_data.amount,ditem->m,ditem->x,ditem->y,ditem->first_sd,ditem->second_sd,ditem->third_sd,0);
+ if (ditem->first_sd){
+ #if 0
+ if (ditem->first_sd->status.party_id > 0){
+ struct party *p;
+ if((p=party_search(ditem->first_sd->status.party_id)) && p->item){
+ struct map_session_data *sd = NULL;
+ int i;
+ for (i = p->itemc + 1; i!=p->itemc; i++) { // initialise counter and loop through the party
+ if (i >= MAX_PARTY)
+ i = 0; // reset counter to 1st person in party so it'll stop when it reaches "itemc"
+ if ((sd=p->member[i].sd)!=NULL && sd->bl.m == ditem->first_sd->bl.m)
+ break;
+ }
+ if (sd){ // if an appropiate party member was found
+ drop_flag = 0;
+ if ((p->itemc++) >= MAX_PARTY)
+ p->itemc = 0;
+ if((flag = pc_additem(ditem->first_sd,&ditem->item_data,ditem->item_data.amount))){
+ clif_additem(ditem->first_sd,0,0,flag);
+ drop_flag = 1;
+ }
+ }
+ }
+ } else
+ #endif
+ if(battle_config.item_auto_get){
+ drop_flag = 0;
+ if((flag = pc_additem(ditem->first_sd,&ditem->item_data,ditem->item_data.amount))){
+ clif_additem(ditem->first_sd,0,0,flag);
+ drop_flag = 1;
+ }
}
- aFree(ditem);
- return 0;
}
- map_addflooritem(&ditem->item_data,ditem->item_data.amount,ditem->m,ditem->x,ditem->y,ditem->first_sd,ditem->second_sd,ditem->third_sd,0);
+ if (drop_flag) {
+ map_addflooritem(&ditem->item_data,ditem->item_data.amount,ditem->m,ditem->x,ditem->y,ditem->first_sd,ditem->second_sd,ditem->third_sd,0);
+ }
aFree(ditem);
return 0;
diff --git a/src/map/party.c b/src/map/party.c
index 3c3c12886..6c6bf9567 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -69,12 +69,12 @@ struct party* party_searchname(char *str)
return p;
}
// 作成要求
-int party_create(struct map_session_data *sd,char *name)
+int party_create(struct map_session_data *sd,char *name,int item,int item2)
{
nullpo_retr(0, sd);
if(sd->status.party_id==0)
- intif_create_party(sd,name);
+ intif_create_party(sd,name,item,item2);
else
clif_party_created(sd,2);
return 0;
diff --git a/src/map/party.h b/src/map/party.h
index 5259df7ff..203dd1057 100644
--- a/src/map/party.h
+++ b/src/map/party.h
@@ -13,7 +13,7 @@ void do_final_party(void);
struct party *party_search(int party_id);
struct party* party_searchname(char *str);
-int party_create(struct map_session_data *sd,char *name);
+int party_create(struct map_session_data *sd,char *name, int item, int item2);
int party_created(int account_id,int fail,int party_id,char *name);
int party_request_info(int party_id);
int party_invite(struct map_session_data *sd,int account_id);