summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/char/char.c54
-rw-r--r--src/char/char.h3
-rw-r--r--src/char/int_party.c20
3 files changed, 69 insertions, 8 deletions
diff --git a/src/char/char.c b/src/char/char.c
index 1a5fa49e8..85f97e154 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -263,7 +263,7 @@ int mmo_char_tostr(char *str, struct mmo_charstatus *p) {
str_p += sprintf(str_p, "%d\t%d,%d\t%s\t%d,%d,%d\t%d,%d,%d\t%d,%d,%d,%d\t%d,%d,%d,%d,%d,%d\t%d,%d"
"\t%d,%d,%d\t%d,%d,%d\t%d,%d,%d\t%d,%d,%d,%d,%d"
- "\t%s,%d,%d\t%s,%d,%d,%d\t",
+ "\t%s,%d,%d\t%s,%d,%d,%d,%d,%d,%d\t",
p->char_id, p->account_id, p->char_num, p->name, //
p->class_, p->base_level, p->job_level,
p->base_exp, p->job_exp, p->zeny,
@@ -276,7 +276,7 @@ int mmo_char_tostr(char *str, struct mmo_charstatus *p) {
p->weapon, p->shield, p->head_top, p->head_mid, p->head_bottom,
p->last_point.map, p->last_point.x, p->last_point.y, //
p->save_point.map, p->save_point.x, p->save_point.y,
- p->partner_id);
+ p->partner_id,p->father,p->mother,p->child);
for(i = 0; i < 10; i++)
if (p->memo_point[i].map[0]) {
str_p += sprintf(str_p, "%s,%d,%d", p->memo_point[i].map, p->memo_point[i].x, p->memo_point[i].y);
@@ -325,8 +325,28 @@ int mmo_char_fromstr(char *str, struct mmo_charstatus *p) {
// initilialise character
memset(p, '\0', sizeof(struct mmo_charstatus));
-
- // If it's not char structure of version 1008 and after
+
+ // If it's not char structure of version 1363 and after
+ if ((set = sscanf(str, "%d\t%d,%d\t%[^\t]\t%d,%d,%d\t%d,%d,%d\t%d,%d,%d,%d\t%d,%d,%d,%d,%d,%d\t%d,%d"
+ "\t%d,%d,%d\t%d,%d,%d\t%d,%d,%d\t%d,%d,%d,%d,%d"
+ "\t%[^,],%d,%d\t%[^,],%d,%d,%d,%d,%d,%d%n",
+ &tmp_int[0], &tmp_int[1], &tmp_int[2], p->name, //
+ &tmp_int[3], &tmp_int[4], &tmp_int[5],
+ &tmp_int[6], &tmp_int[7], &tmp_int[8],
+ &tmp_int[9], &tmp_int[10], &tmp_int[11], &tmp_int[12],
+ &tmp_int[13], &tmp_int[14], &tmp_int[15], &tmp_int[16], &tmp_int[17], &tmp_int[18],
+ &tmp_int[19], &tmp_int[20],
+ &tmp_int[21], &tmp_int[22], &tmp_int[23], //
+ &tmp_int[24], &tmp_int[25], &tmp_int[26],
+ &tmp_int[27], &tmp_int[28], &tmp_int[29],
+ &tmp_int[30], &tmp_int[31], &tmp_int[32], &tmp_int[33], &tmp_int[34],
+ p->last_point.map, &tmp_int[35], &tmp_int[36], //
+ p->save_point.map, &tmp_int[37], &tmp_int[38], &tmp_int[39],
+ &tmp_int[40], &tmp_int[41], &tmp_int[42], &next)) != 46) {
+ tmp_int[40] = 0; // father
+ tmp_int[41] = 0; // mother
+ tmp_int[42] = 0; // child
+ // If it's not char structure of version 1008 and before 1363
if ((set = sscanf(str, "%d\t%d,%d\t%[^\t]\t%d,%d,%d\t%d,%d,%d\t%d,%d,%d,%d\t%d,%d,%d,%d,%d,%d\t%d,%d"
"\t%d,%d,%d\t%d,%d,%d\t%d,%d,%d\t%d,%d,%d,%d,%d"
"\t%[^,],%d,%d\t%[^,],%d,%d,%d%n",
@@ -385,9 +405,14 @@ int mmo_char_fromstr(char *str, struct mmo_charstatus *p) {
}
// Char structure of version 1008+
} else {
+ set+=3;
//printf("char: new char data ver.3\n");
}
- if (set != 43)
+ // Char structture of version 1363+
+ } else {
+ //printf("char: new char data ver.4\n");
+ }
+ if (set != 46)
return 0;
p->char_id = tmp_int[0];
@@ -430,6 +455,9 @@ int mmo_char_fromstr(char *str, struct mmo_charstatus *p) {
p->save_point.x = tmp_int[37];
p->save_point.y = tmp_int[38];
p->partner_id = tmp_int[39];
+ p->father = tmp_int[40];
+ p->mother = tmp_int[41];
+ p->child = tmp_int[42];
// Some checks
for(i = 0; i < char_num; i++) {
@@ -3566,3 +3594,19 @@ int do_init(int argc, char **argv) {
return 0;
}
+
+int char_married(int pl1,int pl2) {
+ if (char_dat[pl1].char_id == char_dat[pl2].partner_id && char_dat[pl2].char_id == char_dat[pl1].partner_id)
+ return 1;
+ else
+ return 0;
+}
+
+int char_child(int parent_id, int child_id) {
+ if (char_dat[parent_id].child == char_dat[child_id].char_id &&
+ ((char_dat[parent_id].char_id == char_dat[child_id].father) ||
+ (char_dat[parent_id].char_id == char_dat[child_id].mother)))
+ return 1;
+ else
+ return 0;
+}
diff --git a/src/char/char.h b/src/char/char.h
index 3ee2f9f6d..78f4f0194 100644
--- a/src/char/char.h
+++ b/src/char/char.h
@@ -24,6 +24,9 @@ int mapif_sendall(unsigned char *buf, unsigned int len);
int mapif_sendallwos(int fd,unsigned char *buf, unsigned int len);
int mapif_send(int fd,unsigned char *buf, unsigned int len);
+int char_married(int pl1,int pl2);
+int char_child(int parent_id, int child_id);
+
int char_log(char *fmt, ...);
extern int autosave_interval;
diff --git a/src/char/int_party.c b/src/char/int_party.c
index 31f489d2e..299a75135 100644
--- a/src/char/int_party.c
+++ b/src/char/int_party.c
@@ -180,7 +180,8 @@ struct party* search_partyname(char *str) {
// EXP公平分配できるかチェック
int party_check_exp_share(struct party *p) {
- int i;
+ int i, dudes=0;
+ int pl1=0,pl2=0,pl3=0;
int maxlv = 0, minlv = 0x7fffffff;
for(i = 0; i < MAX_PARTY; i++) {
@@ -190,10 +191,23 @@ int party_check_exp_share(struct party *p) {
minlv = lv;
if (maxlv < lv)
maxlv = lv;
+ if( lv >= 70 ) dudes+=1000;
+ dudes++;
}
}
-
- return (maxlv == 0 || maxlv-minlv <= party_share_level);
+ if((dudes/1000 >= 2) && (dudes%1000 == 3) && (!strcmp(p->member[0].map,p->member[1].map)) && (!strcmp(p->member[1].map,p->member[2].map))) {
+ pl1=search_character_index(p->member[0].name);
+ pl2=search_character_index(p->member[1].name);
+ pl3=search_character_index(p->member[2].name);
+ printf("PARTY: group of 3 Id1 %d lv %d name %s Id2 %d lv %d name %s Id3 %d lv %d name %s\n",pl1,p->member[0].lv,p->member[0].name,pl2,p->member[1].lv,p->member[1].name,pl3,p->member[2].lv,p->member[2].name);
+ if (char_married(pl1,pl2) && char_child(pl1,pl3))
+ return 1;
+ if (char_married(pl1,pl3) && char_child(pl1,pl2))
+ return 1;
+ if (char_married(pl2,pl3) && char_child(pl2,pl1))
+ return 1;
+ }
+ return (maxlv==0 || maxlv-minlv<=party_share_level);
}
// パ?ティが空かどうかチェック