From 8d048f50359a01b56e1224ff8664f0a22ee8821d Mon Sep 17 00:00:00 2001 From: ultramage Date: Thu, 15 Feb 2007 23:22:30 +0000 Subject: - Cleaned up clif_party_info a bit - Reverted some of my mobdb code git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9870 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/atcommand.c | 2 +- src/map/clif.c | 16 +++++++--------- src/map/clif.h | 2 +- src/map/mob.c | 24 ++++++++++++++---------- src/map/party.c | 6 +++--- 5 files changed, 26 insertions(+), 24 deletions(-) (limited to 'src/map') diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 7411abc92..8382d6e14 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -7671,7 +7671,7 @@ int atcommand_changeleader(const int fd, struct map_session_data* sd, const char intif_party_leaderchange(p->party.party_id,p->party.member[pl_mi].account_id,p->party.member[pl_mi].char_id); //Update info. clif_party_main_info(p,-1); - clif_party_info(p,-1); + clif_party_info(p,NULL); return 0; } diff --git a/src/map/clif.c b/src/map/clif.c index 26312a138..9a7d941f2 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -5739,10 +5739,10 @@ int clif_party_join_info(struct party *p, struct map_session_data *sd) * Sends party information * R 00fb .w .24B {.l .24B .16B .B .B}.46B* *------------------------------------------*/ -int clif_party_info(struct party_data* p, int fd) +int clif_party_info(struct party_data* p, struct map_session_data *sd) { unsigned char buf[2+2+NAME_LENGTH+(4+NAME_LENGTH+MAP_NAME_LENGTH+1+1)*MAX_PARTY]; - struct map_session_data* sd = NULL; + struct map_session_data* party_sd = NULL; int i, c; nullpo_retr(0, p); @@ -5754,7 +5754,7 @@ int clif_party_info(struct party_data* p, int fd) struct party_member* m = &p->party.member[i]; if(!m->account_id) continue; - if(sd == NULL) sd = p->data[i].sd; // need at least one member's 'sd' so clif_send() can identify the party + if(party_sd == NULL) party_sd = p->data[i].sd; WBUFL(buf,28+c*46) = m->account_id; memcpy(WBUFP(buf,28+c*46+4), m->name, NAME_LENGTH); @@ -5765,12 +5765,10 @@ int clif_party_info(struct party_data* p, int fd) } WBUFW(buf,2) = 28+c*46; - if(fd >= 0) { // send only to self - if (session[fd] && session[fd]->session_data) - clif_send(buf, WBUFW(buf,2), &((struct map_session_data *)session[fd]->session_data)->bl, SELF); - } else { // send to whole party - if(sd) - clif_send(buf, WBUFW(buf,2), &sd->bl, PARTY); + if(sd) { // send only to self + clif_send(buf, WBUFW(buf,2), &sd->bl, SELF); + } else if (party_sd) { // send to whole party + clif_send(buf, WBUFW(buf,2), &party_sd->bl, PARTY); } return 0; diff --git a/src/map/clif.h b/src/map/clif.h index 61d9e1b3f..8f658819a 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -255,7 +255,7 @@ int clif_movetoattack(struct map_session_data *sd,struct block_list *bl); int clif_party_created(struct map_session_data *sd,int flag); int clif_party_main_info(struct party_data *p, int fd); int clif_party_join_info(struct party *p, struct map_session_data *sd); -int clif_party_info(struct party_data *p,int fd); +int clif_party_info(struct party_data *p, struct map_session_data *sd); int clif_party_invite(struct map_session_data *sd,struct map_session_data *tsd); int clif_party_inviteack(struct map_session_data *sd,char *nick,int flag); int clif_party_option(struct party_data *p,struct map_session_data *sd,int flag); diff --git a/src/map/mob.c b/src/map/mob.c index f3eb3a22d..783248742 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -3215,9 +3215,8 @@ int mob_parse_dbrow(char** str) memcpy(db->sprite, str[1], NAME_LENGTH-1); memcpy(db->jname, str[2], NAME_LENGTH-1); memcpy(db->name, str[3], NAME_LENGTH-1); - - db->lv = cap_value(atoi(str[4]), 1, USHRT_MAX); - + db->lv = atoi(str[4]); + db->lv = cap_value(db->lv, 1, USHRT_MAX); status->max_hp = atoi(str[5]); status->max_sp = atoi(str[6]); @@ -3232,14 +3231,19 @@ int mob_parse_dbrow(char** str) status->rhw.atk2 = atoi(str[11]); status->def = atoi(str[12]); status->mdef = atoi(str[13]); - + status->str = atoi(str[14]); + status->agi = atoi(str[15]); + status->vit = atoi(str[16]); + status->int_ = atoi(str[17]); + status->dex = atoi(str[18]); + status->luk = atoi(str[19]); //All status should be min 1 to prevent divisions by zero from some skills. [Skotlex] - status->str = cap_value(atoi(str[14]), 1, USHRT_MAX); - status->agi = cap_value(atoi(str[15]), 1, USHRT_MAX); - status->vit = cap_value(atoi(str[16]), 1, USHRT_MAX); - status->int_ = cap_value(atoi(str[17]), 1, USHRT_MAX); - status->dex = cap_value(atoi(str[18]), 1, USHRT_MAX); - status->luk = cap_value(atoi(str[19]), 1, USHRT_MAX); + if (status->str < 1) status->str = 1; + if (status->agi < 1) status->agi = 1; + if (status->vit < 1) status->vit = 1; + if (status->int_< 1) status->int_= 1; + if (status->dex < 1) status->dex = 1; + if (status->luk < 1) status->luk = 1; db->range2 = atoi(str[20]); db->range3 = atoi(str[21]); diff --git a/src/map/party.c b/src/map/party.c index 4ac60a65a..dfa8c0e9e 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -244,7 +244,7 @@ int party_recv_info(struct party *sp) continue; clif_party_main_info(p,-1); clif_party_option(p,sd,0x100); - clif_party_info(p,-1); + clif_party_info(p,NULL); sd->state.party_sent=1; } @@ -504,7 +504,7 @@ int party_recv_movemap(int party_id,int account_id,int char_id, unsigned short m return 0; } - clif_party_info(p,-1); + clif_party_info(p,NULL); return 0; } @@ -540,7 +540,7 @@ void party_send_movemap(struct map_session_data *sd) if(sd->status.party_id==p->party.party_id){ clif_party_main_info(p,sd->fd); clif_party_option(p,sd,0x100); - clif_party_info(p,sd->fd); + clif_party_info(p,sd); sd->state.party_sent=1; } } -- cgit v1.2.3-70-g09d2