diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/char/char.c | 31 | ||||
-rw-r--r-- | src/char_sql/char.c | 14 | ||||
-rw-r--r-- | src/common/mmo.h | 2 | ||||
-rw-r--r-- | src/map/clif.c | 53 | ||||
-rw-r--r-- | src/map/map.h | 5 | ||||
-rw-r--r-- | src/map/pc.c | 14 | ||||
-rw-r--r-- | src/map/pc.h | 7 | ||||
-rw-r--r-- | src/map/unit.h | 3 |
8 files changed, 109 insertions, 20 deletions
diff --git a/src/char/char.c b/src/char/char.c index 237e04638..178a20262 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -525,7 +525,7 @@ int mmo_char_tostr(char *str, struct mmo_charstatus *p, struct global_reg *reg, "%d\t%d,%d\t%s\t%d,%d,%d\t%u,%u,%d" //Up to Zeny field "\t%d,%d,%d,%d\t%d,%d,%d,%d,%d,%d\t%d,%d" //Up to Skill Point "\t%d,%d,%d\t%d,%d,%d,%d" //Up to hom id - "\t%d,%d,%d\t%d,%d,%d,%d,%d" //Up to head bottom + "\t%d,%d,%d\t%d,%d,%d,%d,%d,%d" //Up to robe "\t%d,%d,%d\t%d,%d,%d" //last point + save point ",%d,%d,%d,%d,%d,%lu\t", //Family info + delete date p->char_id, p->account_id, p->slot, p->name, // @@ -537,7 +537,7 @@ int mmo_char_tostr(char *str, struct mmo_charstatus *p, struct global_reg *reg, p->option, p->karma, p->manner, // p->party_id, p->guild_id, p->pet_id, p->hom_id, p->hair, p->hair_color, p->clothes_color, - p->weapon, p->shield, p->head_top, p->head_mid, p->head_bottom, + p->weapon, p->shield, p->head_top, p->head_mid, p->head_bottom, p->robe, 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->father,p->mother,p->child,p->fame, // @@ -599,7 +599,26 @@ int mmo_char_fromstr(char *str, struct mmo_charstatus *p, struct global_reg *reg // initilialise character memset(p, '\0', sizeof(struct mmo_charstatus)); -// Char structure of version 146xx (delete date) +// Char structure of version 14797 (robe) + if (sscanf(str, "%d\t%d,%d\t%127[^\t]\t%d,%d,%d\t%u,%u,%d\t%d,%d,%d,%d\t%d,%d,%d,%d,%d,%d\t%d,%d" + "\t%d,%d,%d\t%d,%d,%d,%d\t%d,%d,%d\t%d,%d,%d,%d,%d,%d" + "\t%d,%d,%d\t%d,%d,%d,%d,%d,%d,%d,%d,%lu%n", + &tmp_int[0], &tmp_int[1], &tmp_int[2], tmp_str[0], + &tmp_int[3], &tmp_int[4], &tmp_int[5], + &tmp_uint[0], &tmp_uint[1], &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[44], + &tmp_int[27], &tmp_int[28], &tmp_int[29], + &tmp_int[30], &tmp_int[31], &tmp_int[32], &tmp_int[33], &tmp_int[34], &tmp_int[47], + &tmp_int[45], &tmp_int[35], &tmp_int[36], + &tmp_int[46], &tmp_int[37], &tmp_int[38], &tmp_int[39], + &tmp_int[40], &tmp_int[41], &tmp_int[42], &tmp_int[43], &tmp_ulong[0], &next) != 50) + { + tmp_int[47] = 0; // robe +// Char structure of version 14700 (delete date) if (sscanf(str, "%d\t%d,%d\t%127[^\t]\t%d,%d,%d\t%u,%u,%d\t%d,%d,%d,%d\t%d,%d,%d,%d,%d,%d\t%d,%d" "\t%d,%d,%d\t%d,%d,%d,%d\t%d,%d,%d\t%d,%d,%d,%d,%d" "\t%d,%d,%d\t%d,%d,%d,%d,%d,%d,%d,%d,%lu%n", @@ -742,7 +761,8 @@ int mmo_char_fromstr(char *str, struct mmo_charstatus *p, struct global_reg *reg tmp_int[45] = mapindex_name2id(tmp_str[1]); tmp_int[46] = mapindex_name2id(tmp_str[2]); } // Char structure of version 1500 (homun + mapindex maps) - } // Char structure of version 146xx (delete date) + } // Char structure of version 14700 (delete date) + } // Char structure of version 14797 (robe) safestrncpy(p->name, tmp_str[0], NAME_LENGTH); //Overflow protection [Skotlex] p->char_id = tmp_int[0]; @@ -793,6 +813,7 @@ int mmo_char_fromstr(char *str, struct mmo_charstatus *p, struct global_reg *reg p->last_point.map = tmp_int[45]; p->save_point.map = tmp_int[46]; p->delete_date = tmp_ulong[0]; + p->robe = tmp_int[47]; #ifndef TXT_SQL_CONVERT // Some checks @@ -1837,7 +1858,7 @@ int mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p) offset += 4; #endif #if PACKETVER >= 20110111 - WBUFL(buf,128) = 0; // robe sprite id + WBUFL(buf,128) = p->robe; offset += 4; #endif return 106+offset; diff --git a/src/char_sql/char.c b/src/char_sql/char.c index 517ebed10..3b2e508b6 100644 --- a/src/char_sql/char.c +++ b/src/char_sql/char.c @@ -474,7 +474,7 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus* p) (p->pet_id != cp->pet_id) || (p->weapon != cp->weapon) || (p->hom_id != cp->hom_id) || (p->shield != cp->shield) || (p->head_top != cp->head_top) || (p->head_mid != cp->head_mid) || (p->head_bottom != cp->head_bottom) || (p->delete_date != cp->delete_date) || - (p->rename != cp->rename) + (p->rename != cp->rename) || (p->robe != cp->robe) ) { //Save status if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `base_level`='%d', `job_level`='%d'," @@ -484,7 +484,7 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus* p) "`option`='%d',`party_id`='%d',`guild_id`='%d',`pet_id`='%d',`homun_id`='%d'," "`weapon`='%d',`shield`='%d',`head_top`='%d',`head_mid`='%d',`head_bottom`='%d'," "`last_map`='%s',`last_x`='%d',`last_y`='%d',`save_map`='%s',`save_x`='%d',`save_y`='%d', `rename`='%d'," - "`delete_date`='%lu'" + "`delete_date`='%lu',`robe`='%d'" " WHERE `account_id`='%d' AND `char_id` = '%d'", char_db, p->base_level, p->job_level, p->base_exp, p->job_exp, p->zeny, @@ -495,6 +495,7 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus* p) mapindex_id2name(p->last_point.map), p->last_point.x, p->last_point.y, mapindex_id2name(p->save_point.map), p->save_point.x, p->save_point.y, p->rename, (unsigned long)p->delete_date, // FIXME: platform-dependent size + p->robe, p->account_id, p->char_id) ) { Sql_ShowDebug(sql_handle); @@ -844,7 +845,8 @@ int mmo_chars_fromsql(struct char_session_data* sd, uint8* buf) "`char_id`,`char_num`,`name`,`class`,`base_level`,`job_level`,`base_exp`,`job_exp`,`zeny`," "`str`,`agi`,`vit`,`int`,`dex`,`luk`,`max_hp`,`hp`,`max_sp`,`sp`," "`status_point`,`skill_point`,`option`,`karma`,`manner`,`hair`,`hair_color`," - "`clothes_color`,`weapon`,`shield`,`head_top`,`head_mid`,`head_bottom`,`last_map`,`rename`,`delete_date`" + "`clothes_color`,`weapon`,`shield`,`head_top`,`head_mid`,`head_bottom`,`last_map`,`rename`,`delete_date`," + "`robe`" " FROM `%s` WHERE `account_id`='%d' AND `char_num` < '%d'", char_db, sd->account_id, MAX_CHARS) || SQL_ERROR == SqlStmt_Execute(stmt) || SQL_ERROR == SqlStmt_BindColumn(stmt, 0, SQLDT_INT, &p.char_id, 0, NULL, NULL) @@ -882,6 +884,7 @@ int mmo_chars_fromsql(struct char_session_data* sd, uint8* buf) || SQL_ERROR == SqlStmt_BindColumn(stmt, 32, SQLDT_STRING, &last_map, sizeof(last_map), NULL, NULL) || SQL_ERROR == SqlStmt_BindColumn(stmt, 33, SQLDT_SHORT, &p.rename, 0, NULL, NULL) || SQL_ERROR == SqlStmt_BindColumn(stmt, 34, SQLDT_UINT32, &p.delete_date, 0, NULL, NULL) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 35, SQLDT_SHORT, &p.robe, 0, NULL, NULL) ) { SqlStmt_ShowDebug(stmt); @@ -940,7 +943,7 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything "`str`,`agi`,`vit`,`int`,`dex`,`luk`,`max_hp`,`hp`,`max_sp`,`sp`," "`status_point`,`skill_point`,`option`,`karma`,`manner`,`party_id`,`guild_id`,`pet_id`,`homun_id`,`hair`," "`hair_color`,`clothes_color`,`weapon`,`shield`,`head_top`,`head_mid`,`head_bottom`,`last_map`,`last_x`,`last_y`," - "`save_map`,`save_x`,`save_y`,`partner_id`,`father`,`mother`,`child`,`fame`,`rename`,`delete_date`" + "`save_map`,`save_x`,`save_y`,`partner_id`,`father`,`mother`,`child`,`fame`,`rename`,`delete_date`,`robe`" " FROM `%s` WHERE `char_id`=? LIMIT 1", char_db) || SQL_ERROR == SqlStmt_BindParam(stmt, 0, SQLDT_INT, &char_id, 0) || SQL_ERROR == SqlStmt_Execute(stmt) @@ -994,6 +997,7 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything || SQL_ERROR == SqlStmt_BindColumn(stmt, 47, SQLDT_INT, &p->fame, 0, NULL, NULL) || SQL_ERROR == SqlStmt_BindColumn(stmt, 48, SQLDT_SHORT, &p->rename, 0, NULL, NULL) || SQL_ERROR == SqlStmt_BindColumn(stmt, 49, SQLDT_UINT32, &p->delete_date, 0, NULL, NULL) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 50, SQLDT_SHORT, &p->robe, 0, NULL, NULL) ) { SqlStmt_ShowDebug(stmt); @@ -1615,7 +1619,7 @@ int mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p) offset += 4; #endif #if PACKETVER >= 20110111 - WBUFL(buf,128) = 0; // robe sprite id + WBUFL(buf,128) = p->robe; offset += 4; #endif return 106+offset; diff --git a/src/common/mmo.h b/src/common/mmo.h index 857d42581..c45cec9a0 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -39,6 +39,7 @@ // 20100721 - 2010-07-21aRagexeRE+ - 0x6b, 0x6d // 20100727 - 2010-07-27aRagexeRE+ - 0x6b, 0x6d // 20100803 - 2010-08-03aRagexeRE+ - 0x6b, 0x6d, 0x827, 0x828, 0x829, 0x82a, 0x82b, 0x82c, 0x842, 0x843 +// 20101124 - 2010-11-24aRagexeRE+ - 0x856, 0x857, 0x858 // 20110111 - 2011-01-11aRagexeRE+ - 0x6b, 0x6d #ifndef PACKETVER @@ -330,6 +331,7 @@ struct mmo_charstatus { short weapon; // enum weapon_type short shield; // view-id short head_top,head_mid,head_bottom; + short robe; char name[NAME_LENGTH]; unsigned int base_level,job_level; diff --git a/src/map/clif.c b/src/map/clif.c index d1338314f..0bd3519ff 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -797,13 +797,19 @@ static int clif_set_unit_idle(struct block_list* bl, unsigned char* buffer, bool WBUFW(buf,0) = spawn?0x22b:0x22a; #elif PACKETVER < 20091103 WBUFW(buf,0) = spawn?0x2ed:0x2ee; -#else +#elif PACKETVER < 20101124 WBUFW(buf,0) = spawn?0x7f8:0x7f9; +#else + WBUFW(buf,0) = spawn?0x858:0x857; #endif #if PACKETVER >= 20091103 name = status_get_name(bl); +#if PACKETVER < 20110111 WBUFW(buf,2) = (spawn?62:63)+strlen(name); +#else + WBUFW(buf,2) = (spawn?64:65)+strlen(name); +#endif WBUFB(buf,4) = clif_bl_type(bl); offset+=3; buf = WBUFP(buffer,offset); @@ -877,6 +883,11 @@ static int clif_set_unit_idle(struct block_list* bl, unsigned char* buffer, bool return packet_len(0x7c); } #endif +#if PACKETVER >= 20110111 + WBUFW(buf,34) = vd->robe; + offset+= 2; + buf = WBUFP(buf,offset); +#endif WBUFL(buf,34) = status_get_guild_id(bl); WBUFW(buf,38) = status_get_emblem_id(bl); WBUFW(buf,40) = (sd)? sd->status.manner : 0; @@ -946,13 +957,19 @@ static int clif_set_unit_walking(struct block_list* bl, struct unit_data* ud, un WBUFW(buf, 0) = 0x22c; #elif PACKETVER < 20091103 WBUFW(buf, 0) = 0x2ec; -#else +#elif PACKETVER < 20101124 WBUFW(buf, 0) = 0x7f7; +#else + WBUFW(buf, 0) = 0x856; #endif #if PACKETVER >= 20091103 name = status_get_name(bl); +#if PACKETVER < 20110111 WBUFW(buf, 2) = 69+strlen(name); +#else + WBUFW(buf, 2) = 71+strlen(name); +#endif offset+=2; buf = WBUFP(buffer,offset); #endif @@ -989,6 +1006,11 @@ static int clif_set_unit_walking(struct block_list* bl, struct unit_data* ud, un WBUFW(buf,32) = vd->hair_color; WBUFW(buf,34) = vd->cloth_color; WBUFW(buf,36) = (sd)? sd->head_dir : 0; +#if PACKETVER >= 20110111 + WBUFW(buf,38) = vd->robe; + offset+= 2; + buf = WBUFP(buf,offset); +#endif WBUFL(buf,38) = status_get_guild_id(bl); WBUFW(buf,42) = status_get_emblem_id(bl); WBUFW(buf,44) = (sd)? sd->status.manner : 0; @@ -2057,7 +2079,7 @@ void clif_inventorylist(struct map_session_data *sd) WBUFW(bufe,ne*se+28)=0; //Unknown #endif #if PACKETVER >= 20100629 - if (sd->inventory_data[i]->equip&EQP_HELM) + if (sd->inventory_data[i]->equip&EQP_VISIBLE) WBUFW(bufe,ne*se+30)= sd->inventory_data[i]->look; else WBUFW(bufe,ne*se+30)=0; @@ -2140,7 +2162,7 @@ void clif_equiplist(struct map_session_data *sd) WBUFW(buf,n*cmd+28)=0; //Unknown #endif #if PACKETVER >= 20100629 - if (sd->inventory_data[i]->equip&EQP_HELM) + if (sd->inventory_data[i]->equip&EQP_VISIBLE) WBUFW(buf,n*cmd+30)= sd->inventory_data[i]->look; else WBUFW(buf,n*cmd+30)=0; @@ -2705,6 +2727,17 @@ void clif_changelook(struct block_list *bl,int type,int val) #endif //Shoes? No packet uses this.... break; + case LOOK_BODY: + case LOOK_FLOOR: + // unknown purpose + break; + case LOOK_ROBE: +#if PACKETVER < 20110111 + return; +#else + vd->robe = val; +#endif + break; } // prevent leaking the presence of GM-hidden objects @@ -2726,8 +2759,7 @@ void clif_changelook(struct block_list *bl,int type,int val) WBUFW(buf,9)=vd->shield; } else { WBUFB(buf,6)=type; - WBUFW(buf,7)=val; - WBUFW(buf,9)=0; + WBUFL(buf,7)=val; } clif_send(buf,packet_len(0x1d7),bl,target); #endif @@ -2952,7 +2984,7 @@ int clif_equipitemack(struct map_session_data *sd,int n,int pos,int ok) #if PACKETVER < 20100629 WFIFOB(fd,6)=ok; #else - if (ok && sd->inventory_data[n]->equip&EQP_HELM) + if (ok && sd->inventory_data[n]->equip&EQP_VISIBLE) WFIFOW(fd,6)=sd->inventory_data[n]->look; else WFIFOW(fd,6)=0; @@ -8072,7 +8104,7 @@ void clif_viewequip_ack(struct map_session_data* sd, struct map_session_data* ts WFIFOL(fd, n*s+63) = tsd->status.inventory[i].expire_time; WFIFOW(fd, n*s+67) = 0; #if PACKETVER >= 20100629 - if (tsd->inventory_data[i]->equip&EQP_HELM) + if (tsd->inventory_data[i]->equip&EQP_VISIBLE) WFIFOW(fd, n*s+69) = tsd->inventory_data[i]->look; else WFIFOW(fd, n*s+69) = 0; @@ -14978,6 +15010,11 @@ static int packetdb_readdb(void) 3, -1, 8, -1, 86, 2, 6, 6, -1, -1, 4, 10, 10, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 3, 2, 66, 5, 2, 12, 6, 0, 0, + //#0x0840 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, -1, -1, -1, 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, 0, 0, 0, 0, 0, 0, 0, }; struct { void (*func)(int, struct map_session_data *); diff --git a/src/map/map.h b/src/map/map.h index 3b1775e46..8e0c11a03 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -354,7 +354,10 @@ enum _look { LOOK_HAIR_COLOR, LOOK_CLOTHES_COLOR, LOOK_SHIELD, - LOOK_SHOES + LOOK_SHOES, + LOOK_BODY, + LOOK_FLOOR, + LOOK_ROBE, }; // used by map_setcell() diff --git a/src/map/pc.c b/src/map/pc.c index 4cfec2de8..e1ecc171e 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -6398,6 +6398,7 @@ int pc_equiplookall(struct map_session_data *sd) clif_changelook(&sd->bl,LOOK_HEAD_BOTTOM,sd->status.head_bottom); clif_changelook(&sd->bl,LOOK_HEAD_TOP,sd->status.head_top); clif_changelook(&sd->bl,LOOK_HEAD_MID,sd->status.head_mid); + clif_changelook(&sd->bl, LOOK_ROBE, sd->status.robe); return 0; } @@ -6454,6 +6455,9 @@ int pc_changelook(struct map_session_data *sd,int type,int val) break; case LOOK_SHOES: break; + case LOOK_ROBE: + sd->status.robe = val; + break; } clif_changelook(&sd->bl,type,val); return 0; @@ -7184,6 +7188,11 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos) } if(pos & EQP_SHOES) clif_changelook(&sd->bl,LOOK_SHOES,0); + if( pos&EQP_GARMENT ) + { + sd->status.robe = id ? id->look : 0; + clif_changelook(&sd->bl, LOOK_ROBE, sd->status.robe); + } pc_checkallowskill(sd); //Check if status changes should be halted. @@ -7274,6 +7283,11 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag) } if(sd->status.inventory[n].equip & EQP_SHOES) clif_changelook(&sd->bl,LOOK_SHOES,0); + if( sd->status.inventory[n].equip&EQP_GARMENT ) + { + sd->status.robe = 0; + clif_changelook(&sd->bl, LOOK_ROBE, 0); + } clif_unequipitemack(sd,n,sd->status.inventory[n].equip,1); diff --git a/src/map/pc.h b/src/map/pc.h index 7b14d45d8..9ed474b13 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -494,6 +494,13 @@ enum equip_pos { #define EQP_HELM (EQP_HEAD_LOW|EQP_HEAD_MID|EQP_HEAD_TOP) #define EQP_ACC (EQP_ACC_L|EQP_ACC_R) +/// Equip positions that use a visible sprite +#if PACKETVER < 20110111 + #define EQP_VISIBLE EQP_HELM +#else + #define EQP_VISIBLE (EQP_HELM|EQP_GARMENT) +#endif + //Equip indexes constants. (eg: sd->equip_index[EQI_AMMO] returns the index //where the arrows are equipped) enum equip_index { diff --git a/src/map/unit.h b/src/map/unit.h index fd5a83208..e349a7466 100644 --- a/src/map/unit.h +++ b/src/map/unit.h @@ -47,9 +47,10 @@ struct unit_data { struct view_data { unsigned short - class_, + class_, weapon, shield, //Or left-hand weapon. + robe, head_top, head_mid, head_bottom, |