diff options
author | Haru <haru@dotalux.com> | 2019-05-05 23:23:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-05 23:23:05 +0200 |
commit | b1970eac663b641b93e30ec24f2b3d8ee02ce8f6 (patch) | |
tree | f363d01b6181e4cfcdad109dc6d56873a73eaa15 /src | |
parent | aa79da0e801a536b22911d47fd12df351c36214e (diff) | |
parent | b8ce5e9e1352abc45b08f92eb50890f202b1b230 (diff) | |
download | hercules-b1970eac663b641b93e30ec24f2b3d8ee02ce8f6.tar.gz hercules-b1970eac663b641b93e30ec24f2b3d8ee02ce8f6.tar.bz2 hercules-b1970eac663b641b93e30ec24f2b3d8ee02ce8f6.tar.xz hercules-b1970eac663b641b93e30ec24f2b3d8ee02ce8f6.zip |
Merge pull request #2432 from 4144/updatepackets
Update packets up to 2019-05-02
Diffstat (limited to 'src')
33 files changed, 1135 insertions, 274 deletions
diff --git a/src/char/char.c b/src/char/char.c index 5528fb8aa..44225ecb5 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -2153,11 +2153,13 @@ static void char_send_HC_ACK_CHARINFO_PER_PAGE(int fd, struct char_session_data static void char_send_HC_ACK_CHARINFO_PER_PAGE_tail(int fd, struct char_session_data *sd) { +#if PACKETVER_MAIN_NUM >= 20130522 || PACKETVER_RE_NUM >= 20130327 || defined(PACKETVER_ZERO) WFIFOHEAD(fd, sizeof(struct PACKET_HC_ACK_CHARINFO_PER_PAGE)); struct PACKET_HC_ACK_CHARINFO_PER_PAGE *p = WFIFOP(fd, 0); p->packetId = HEADER_HC_ACK_CHARINFO_PER_PAGE; p->packetLen = sizeof(struct PACKET_HC_ACK_CHARINFO_PER_PAGE); WFIFOSET(fd, p->packetLen); +#endif } /* Sends character ban list */ diff --git a/src/char/int_guild.c b/src/char/int_guild.c index 9c0be1629..8e05c76e2 100644 --- a/src/char/int_guild.c +++ b/src/char/int_guild.c @@ -319,8 +319,8 @@ static int inter_guild_tosql(struct guild *g, int flag) SQL->EscapeStringLen(inter->sql_handle, esc_name, e->name, strnlen(e->name, NAME_LENGTH)); SQL->EscapeStringLen(inter->sql_handle, esc_mes, e->mes, strnlen(e->mes, sizeof(e->mes))); - if( SQL_ERROR == SQL->Query(inter->sql_handle, "REPLACE INTO `%s` (`guild_id`,`account_id`,`name`,`mes`) " - "VALUES ('%d','%d','%s','%s')", guild_expulsion_db, g->guild_id, e->account_id, esc_name, esc_mes) ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "REPLACE INTO `%s` (`guild_id`,`account_id`, `char_id`, `name`,`mes`) " + "VALUES ('%d','%d','%d','%s','%s')", guild_expulsion_db, g->guild_id, e->account_id, e->char_id, esc_name, esc_mes) ) Sql_ShowDebug(inter->sql_handle); } } @@ -444,8 +444,14 @@ static struct guild *inter_guild_fromsql(int guild_id) m->position = MAX_GUILDPOSITION - 1; SQL->GetData(inter->sql_handle, 11, &data, &len); memcpy(m->name, data, min(len, NAME_LENGTH)); SQL->GetData(inter->sql_handle, 12, &data, NULL); - if (data != NULL) + if (data != NULL) { m->last_login = atoi(data); + // 2036-12-31 + if (m->last_login > 2114283600) { + ShowError("Last login time bigger than allowd value in %d:%s: %u\n", guild_id, g->name, m->last_login); + m->last_login = 0; + } + } m->modified = GS_MEMBER_UNMODIFIED; } @@ -488,7 +494,7 @@ static struct guild *inter_guild_fromsql(int guild_id) } //printf("- Read guild_expulsion %d from sql \n",guild_id); - if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `account_id`,`name`,`mes` FROM `%s` WHERE `guild_id`='%d'", guild_expulsion_db, guild_id) ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `account_id`,`char_id`,`name`,`mes` FROM `%s` WHERE `guild_id`='%d'", guild_expulsion_db, guild_id) ) { Sql_ShowDebug(inter->sql_handle); aFree(g); @@ -499,8 +505,9 @@ static struct guild *inter_guild_fromsql(int guild_id) struct guild_expulsion *e = &g->expulsion[i]; SQL->GetData(inter->sql_handle, 0, &data, NULL); e->account_id = atoi(data); - SQL->GetData(inter->sql_handle, 1, &data, &len); memcpy(e->name, data, min(len, NAME_LENGTH)); - SQL->GetData(inter->sql_handle, 2, &data, &len); memcpy(e->mes, data, min(len, sizeof(e->mes))); + SQL->GetData(inter->sql_handle, 1, &data, NULL); e->char_id = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, &len); memcpy(e->name, data, min(len, NAME_LENGTH)); + SQL->GetData(inter->sql_handle, 3, &data, &len); memcpy(e->mes, data, min(len, sizeof(e->mes))); } //printf("- Read guild_skill %d from sql \n",guild_id); @@ -1038,6 +1045,7 @@ static bool inter_guild_leave(int guild_id, int account_id, int char_id, int fla } // Save the expulsion entry g->expulsion[j].account_id = account_id; + g->expulsion[j].char_id = char_id; safestrncpy(g->expulsion[j].name, g->member[i].name, NAME_LENGTH); safestrncpy(g->expulsion[j].mes, mes, 40); } diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h index 02d6c9631..506881467 100644 --- a/src/common/HPMDataCheck.h +++ b/src/common/HPMDataCheck.h @@ -671,6 +671,7 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { { "PACKET_ZC_ACK_OPEN_WRITE_MAIL", sizeof(struct PACKET_ZC_ACK_OPEN_WRITE_MAIL), SERVER_TYPE_MAP }, { "PACKET_ZC_ACK_REMOVE_ITEM_MAIL", sizeof(struct PACKET_ZC_ACK_REMOVE_ITEM_MAIL), SERVER_TYPE_MAP }, { "PACKET_ZC_ACK_REQMAKINGITEM", sizeof(struct PACKET_ZC_ACK_REQMAKINGITEM), SERVER_TYPE_MAP }, + { "PACKET_ZC_ACK_REQNAMEALL", sizeof(struct PACKET_ZC_ACK_REQNAMEALL), SERVER_TYPE_MAP }, { "PACKET_ZC_ACK_SCHEDULER_CASHITEM", sizeof(struct PACKET_ZC_ACK_SCHEDULER_CASHITEM), SERVER_TYPE_MAP }, { "PACKET_ZC_ACK_SCHEDULER_CASHITEM_sub", sizeof(struct PACKET_ZC_ACK_SCHEDULER_CASHITEM_sub), SERVER_TYPE_MAP }, { "PACKET_ZC_ACK_TOUSESKILL", sizeof(struct PACKET_ZC_ACK_TOUSESKILL), SERVER_TYPE_MAP }, @@ -799,7 +800,6 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { { "packet_quest_update_header", sizeof(struct packet_quest_update_header), SERVER_TYPE_MAP }, { "packet_quest_update_hunt", sizeof(struct packet_quest_update_hunt), SERVER_TYPE_MAP }, { "packet_reqname_ack", sizeof(struct packet_reqname_ack), SERVER_TYPE_MAP }, - { "packet_reqnameall_ack", sizeof(struct packet_reqnameall_ack), SERVER_TYPE_MAP }, { "packet_roulette_close_ack", sizeof(struct packet_roulette_close_ack), SERVER_TYPE_MAP }, { "packet_roulette_generate_ack", sizeof(struct packet_roulette_generate_ack), SERVER_TYPE_MAP }, { "packet_roulette_info_ack", sizeof(struct packet_roulette_info_ack), SERVER_TYPE_MAP }, diff --git a/src/common/mmo.h b/src/common/mmo.h index a29b0f2db..aafa54008 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -856,6 +856,7 @@ struct guild_expulsion { char name[NAME_LENGTH]; char mes[40]; int account_id; + int char_id; }; struct guild_skill { diff --git a/src/common/packets/packets2019_len_main.h b/src/common/packets/packets2019_len_main.h index 79c8d3f51..f55db7cd0 100644 --- a/src/common/packets/packets2019_len_main.h +++ b/src/common/packets/packets2019_len_main.h @@ -3793,7 +3793,7 @@ packetLen(0x0a46, 14) // CZ_REQ_STYLE_CHANGE packetLen(0x0a47, 3) // ZC_STYLE_CHANGE_RES // Packet: 0x0a48 -packetLen(0x0a48, 2) +packetLen(0x0a48, 2) // CZ_STYLE_CLOSE // Packet: 0x0a49 packetLen(0x0a49, 22) // CZ_PRIVATE_AIRSHIP_REQUEST @@ -3949,7 +3949,7 @@ packetLen(0x0a86, -1) packetLen(0x0a87, -1) // Packet: 0x0a88 -packetLen(0x0a88, 2) +packetLen(0x0a88, 2) // CZ_COOLDOWN_RESET // Packet: 0x0a89 packetLen(0x0a89, 61) // ZC_NOTIFY_OFFLINE_STORE @@ -4210,7 +4210,7 @@ packetLen(0x0add, 24) // ZC_ITEM_FALL_ENTRY packetLen(0x0ade, 6) // ZC_OVERWEIGHT_PERCENT // Packet: 0x0adf -packetLen(0x0adf, 58) // ZC_ACK_REQNAME +packetLen(0x0adf, 58) // ZC_ACK_REQNAME_TITLE // Packet: 0x0ae0 packetLen(0x0ae0, 30) @@ -4426,11 +4426,28 @@ packetLen(0x0b22, 6) #endif // Packet: 0x0b23 -#if PACKETVER >= 20190306 +#if PACKETVER >= 20190417 +packetLen(0x0b23, 6) +#elif PACKETVER >= 20190306 // removed #elif PACKETVER >= 20190227 packetLen(0x0b23, 10) #endif +// Packet: 0x0b24 +#if PACKETVER >= 20190417 +packetLen(0x0b24, 6) +#endif + +// Packet: 0x0b25 +#if PACKETVER >= 20190417 +packetLen(0x0b25, 6) +#endif + +// Packet: 0x0b26 +#if PACKETVER >= 20190417 +packetLen(0x0b26, 18) +#endif + #endif /* COMMON_PACKETS2019_LEN_MAIN_H */ diff --git a/src/common/packets/packets2019_len_re.h b/src/common/packets/packets2019_len_re.h index c43b65cd9..2f68261cd 100644 --- a/src/common/packets/packets2019_len_re.h +++ b/src/common/packets/packets2019_len_re.h @@ -3799,7 +3799,7 @@ packetLen(0x0a46, 14) // CZ_REQ_STYLE_CHANGE packetLen(0x0a47, 3) // ZC_STYLE_CHANGE_RES // Packet: 0x0a48 -packetLen(0x0a48, 2) +packetLen(0x0a48, 2) // CZ_STYLE_CLOSE // Packet: 0x0a49 packetLen(0x0a49, 22) // CZ_PRIVATE_AIRSHIP_REQUEST @@ -3955,7 +3955,7 @@ packetLen(0x0a86, -1) packetLen(0x0a87, -1) // Packet: 0x0a88 -packetLen(0x0a88, 2) +packetLen(0x0a88, 2) // CZ_COOLDOWN_RESET // Packet: 0x0a89 packetLen(0x0a89, 61) // ZC_NOTIFY_OFFLINE_STORE @@ -4216,7 +4216,7 @@ packetLen(0x0add, 24) // ZC_ITEM_FALL_ENTRY packetLen(0x0ade, 6) // ZC_OVERWEIGHT_PERCENT // Packet: 0x0adf -packetLen(0x0adf, 58) // ZC_ACK_REQNAME +packetLen(0x0adf, 58) // ZC_ACK_REQNAME_TITLE // Packet: 0x0ae0 packetLen(0x0ae0, 30) @@ -4432,11 +4432,28 @@ packetLen(0x0b22, 6) #endif // Packet: 0x0b23 -#if PACKETVER >= 20190306 +#if PACKETVER >= 20190417 +packetLen(0x0b23, 6) +#elif PACKETVER >= 20190306 // removed #elif PACKETVER >= 20190227 packetLen(0x0b23, 10) #endif +// Packet: 0x0b24 +#if PACKETVER >= 20190417 +packetLen(0x0b24, 6) +#endif + +// Packet: 0x0b25 +#if PACKETVER >= 20190417 +packetLen(0x0b25, 6) +#endif + +// Packet: 0x0b26 +#if PACKETVER >= 20190417 +packetLen(0x0b26, 18) +#endif + #endif /* COMMON_PACKETS2019_LEN_RE_H */ diff --git a/src/common/packets/packets2019_len_zero.h b/src/common/packets/packets2019_len_zero.h index 85098505a..24abdb7bd 100644 --- a/src/common/packets/packets2019_len_zero.h +++ b/src/common/packets/packets2019_len_zero.h @@ -3793,7 +3793,7 @@ packetLen(0x0a46, 14) // CZ_REQ_STYLE_CHANGE packetLen(0x0a47, 3) // ZC_STYLE_CHANGE_RES // Packet: 0x0a48 -packetLen(0x0a48, 2) +packetLen(0x0a48, 2) // CZ_STYLE_CLOSE // Packet: 0x0a49 packetLen(0x0a49, 22) // CZ_PRIVATE_AIRSHIP_REQUEST @@ -3946,10 +3946,10 @@ packetLen(0x0a85, 82) packetLen(0x0a86, -1) // Packet: 0x0a87 -packetLen(0x0a87, -1) +packetLen(0x0a87, -1) // ZC_BAN_LIST // Packet: 0x0a88 -packetLen(0x0a88, 2) +packetLen(0x0a88, 2) // CZ_COOLDOWN_RESET // Packet: 0x0a89 packetLen(0x0a89, 61) // ZC_NOTIFY_OFFLINE_STORE @@ -4210,7 +4210,7 @@ packetLen(0x0add, 24) // ZC_ITEM_FALL_ENTRY packetLen(0x0ade, 6) // ZC_OVERWEIGHT_PERCENT // Packet: 0x0adf -packetLen(0x0adf, 58) // ZC_ACK_REQNAME +packetLen(0x0adf, 58) // ZC_ACK_REQNAME_TITLE // Packet: 0x0ae0 packetLen(0x0ae0, 30) @@ -4417,5 +4417,51 @@ packetLen(0x0b21, 13) packetLen(0x0b22, 5) #endif +// Packet: 0x0b23 +#if PACKETVER >= 20190410 +packetLen(0x0b23, 6) +#endif + +// Packet: 0x0b24 +#if PACKETVER >= 20190424 +packetLen(0x0b24, 6) +#endif + +// Packet: 0x0b25 +#if PACKETVER >= 20190424 +packetLen(0x0b25, 6) +#endif + +// Packet: 0x0b26 +#if PACKETVER >= 20190424 +packetLen(0x0b26, 16) +#endif + +// Packet: 0x0b27 +#if PACKETVER >= 20190502 +packetLen(0x0b27, -1) +#elif PACKETVER >= 20190424 +packetLen(0x0b27, 2) +#endif + +// Packet: 0x0b28 +#if PACKETVER >= 20190502 +packetLen(0x0b28, 22) +#elif PACKETVER >= 20190424 +packetLen(0x0b28, -1) +#endif + +// Packet: 0x0b29 +#if PACKETVER >= 20190502 +packetLen(0x0b29, 6) +#elif PACKETVER >= 20190424 +packetLen(0x0b29, 3) +#endif + +// Packet: 0x0b2a +#if PACKETVER >= 20190502 +packetLen(0x0b2a, 6) +#endif + #endif /* COMMON_PACKETS2019_LEN_ZERO_H */ diff --git a/src/common/socket.c b/src/common/socket.c index dc5b06da0..8ee4f06e2 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -1856,7 +1856,7 @@ static void socket_datasync(int fd, bool send) WFIFOL(fd, 4 + ( i * 4 ) ) = data_list[i].length; } - WFIFOSET(fd, p_len); + WFIFOSET2(fd, p_len); } else { for( i = 0; i < alen; i++ ) { if( RFIFOL(fd, 4 + (i * 4) ) != data_list[i].length ) { @@ -1865,7 +1865,7 @@ static void socket_datasync(int fd, bool send) WFIFOW(fd, 0) = 0x2b0a; WFIFOW(fd, 2) = 8; WFIFOL(fd, 4) = 0; - WFIFOSET(fd, 8); + WFIFOSET2(fd, 8); sockt->flush(fd); /* shut down */ ShowFatalError("Servers are out of sync! recompile from scratch (%d)\n",i); diff --git a/src/map/atcommand.c b/src/map/atcommand.c index fa4436eed..8bca17fa1 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -868,7 +868,7 @@ ACMD(speed) *------------------------------------------*/ ACMD(storage) { - if (sd->npc_id || sd->state.vending || sd->state.buyingstore || sd->state.trading || sd->state.storage_flag) + if (sd->npc_id || sd->state.vending || sd->state.prevend || sd->state.buyingstore || sd->state.trading || sd->state.storage_flag) return false; if (storage->open(sd) == 1) { //Already open. @@ -891,7 +891,7 @@ ACMD(guildstorage) return false; } - if (sd->npc_id || sd->state.vending || sd->state.buyingstore || sd->state.trading) + if (sd->npc_id || sd->state.vending || sd->state.prevend || sd->state.buyingstore || sd->state.trading) return false; if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) { @@ -5425,7 +5425,7 @@ ACMD(clearcart) return false; } - if (sd->state.vending) { + if (sd->state.vending || sd->state.prevend) { clif->message(fd, msg_fd(fd,548)); // You can't clean a cart while vending! return false; } diff --git a/src/map/battle.c b/src/map/battle.c index ba7c1130d..b06de267d 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -7418,6 +7418,7 @@ static const struct battle_data { { "ping_timer_inverval", &battle_config.ping_timer_interval, 30, 0, 99999999, }, { "ping_time", &battle_config.ping_time, 20, 0, 99999999, }, { "option_drop_max_loop", &battle_config.option_drop_max_loop, 10, 1, 100000, }, + { "drop_connection_on_quit", &battle_config.drop_connection_on_quit, 0, 0, 1, }, }; static bool battle_set_value_sub(int index, int value) diff --git a/src/map/battle.h b/src/map/battle.h index a99e95c86..8743274ee 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -583,8 +583,10 @@ struct Battle_Config { int ping_timer_interval; int ping_time; - + int option_drop_max_loop; + + int drop_connection_on_quit; }; /* criteria for battle_config.idletime_critera */ diff --git a/src/map/buyingstore.c b/src/map/buyingstore.c index df622e4ab..8cac65775 100644 --- a/src/map/buyingstore.c +++ b/src/map/buyingstore.c @@ -91,7 +91,7 @@ static void buyingstore_create(struct map_session_data *sd, int zenylimit, unsig return; } - if( !battle_config.feature_buying_store || pc_istrading(sd) || sd->buyingstore.slots == 0 || count > sd->buyingstore.slots || zenylimit <= 0 || zenylimit > sd->status.zeny || !storename[0] ) + if( !battle_config.feature_buying_store || pc_istrading(sd) || sd->state.prevend || sd->buyingstore.slots == 0 || count > sd->buyingstore.slots || zenylimit <= 0 || zenylimit > sd->status.zeny || !storename[0] ) {// disabled or invalid input sd->buyingstore.slots = 0; clif->buyingstore_open_failed(sd, BUYINGSTORE_CREATE, 0); @@ -218,7 +218,7 @@ static void buyingstore_open(struct map_session_data *sd, int account_id) struct map_session_data* pl_sd; nullpo_retv(sd); - if( !battle_config.feature_buying_store || pc_istrading(sd) ) + if (!battle_config.feature_buying_store || pc_istrading(sd) || sd->state.prevend) {// not allowed to sell return; } @@ -255,7 +255,7 @@ static void buyingstore_trade(struct map_session_data* sd, int account_id, unsig return; } - if( !battle_config.feature_buying_store || pc_istrading(sd) ) + if (!battle_config.feature_buying_store || pc_istrading(sd) || sd->state.prevend) {// not allowed to sell clif->buyingstore_trade_failed_seller(sd, BUYINGSTORE_TRADE_SELLER_FAILED, 0); return; diff --git a/src/map/chat.c b/src/map/chat.c index 77a12a560..b650ff029 100644 --- a/src/map/chat.c +++ b/src/map/chat.c @@ -102,7 +102,7 @@ static bool chat_createpcchat(struct map_session_data *sd, const char *title, co if (sd->chat_id != 0) return false; //Prevent people abusing the chat system by creating multiple chats, as pointed out by End of Exam. [Skotlex] - if( sd->state.vending || sd->state.buyingstore ) + if (sd->state.vending || sd->state.prevend || sd->state.buyingstore) {// not chat, when you already have a store open return false; } @@ -147,7 +147,7 @@ static bool chat_joinchat(struct map_session_data *sd, int chatid, const char *p cd = map->id2cd(chatid); if (cd == NULL || cd->bl.type != BL_CHAT || cd->bl.m != sd->bl.m - || sd->state.vending || sd->state.buyingstore || sd->chat_id != 0 + || sd->state.vending || sd->state.prevend || sd->state.buyingstore || sd->chat_id != 0 || ((cd->owner->type == BL_NPC) ? cd->users+1 : cd->users) >= cd->limit ) { clif->joinchatfail(sd,0); // room full diff --git a/src/map/clif.c b/src/map/clif.c index 38d0215d3..299c69a1c 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -2943,7 +2943,7 @@ static void clif_inventoryStart(struct map_session_data *sd, enum inventory_type p->invType = type; #endif #if PACKETVER_RE_NUM >= 20180919 || PACKETVER_ZERO_NUM >= 20180919 || PACKETVER_MAIN_NUM >= 20181002 - int strLen = (int)safestrnlen(name, 24); + int strLen = (int)safestrnlen(name, 24) + 1; if (strLen > 24) strLen = 24; const int len = sizeof(struct ZC_INVENTORY_START) + strLen; @@ -4311,22 +4311,25 @@ static void clif_addchat(struct chat_data *cd, struct map_session_data *sd) /// role: /// 0 = owner (menu) /// 1 = normal -static void clif_changechatowner(struct chat_data *cd, struct map_session_data *sd) +static void clif_chatRoleChange(struct chat_data *cd, struct map_session_data *sd, struct block_list* bl, int isNotOwner) { - unsigned char buf[64]; - nullpo_retv(sd); - nullpo_retv(cd); + nullpo_retv(bl); + struct PACKET_ZC_ROLE_CHANGE p; - WBUFW(buf, 0) = 0xe1; - WBUFL(buf, 2) = 1; - memcpy(WBUFP(buf,6),cd->usersd[0]->status.name,NAME_LENGTH); + p.packetType = HEADER_ZC_ROLE_CHANGE; + p.flag = isNotOwner; + memcpy(&p.name, sd->status.name, NAME_LENGTH); + clif->send(&p, sizeof(struct PACKET_ZC_ROLE_CHANGE), bl, CHAT); +} - WBUFW(buf,30) = 0xe1; - WBUFL(buf,32) = 0; - memcpy(WBUFP(buf,36),sd->status.name,NAME_LENGTH); +static void clif_changechatowner(struct chat_data *cd, struct map_session_data *sd) +{ + nullpo_retv(sd); + nullpo_retv(cd); - clif->send(buf,packet_len(0xe1)*2,&sd->bl,CHAT); + clif->chatRoleChange(cd, cd->usersd[0], &sd->bl, 1); + clif->chatRoleChange(cd, sd, &sd->bl, 0); } /// Notify about user leaving the chatroom (ZC_MEMBER_EXIT). @@ -7134,14 +7137,17 @@ static void clif_party_job_and_level(struct map_session_data *sd) /// 1 = auto-deny party invites static void clif_partyinvitationstate(struct map_session_data *sd) { +#if PACKETVER_MAIN_NUM >= 20070911 || defined(PACKETVER_RE) || PACKETVER_AD_NUM >= 20070911 || PACKETVER_SAK_NUM >= 20070904 || defined(PACKETVER_ZERO) int fd; nullpo_retv(sd); fd = sd->fd; - WFIFOHEAD(fd, packet_len(0x2c9)); - WFIFOW(fd, 0) = 0x2c9; - WFIFOB(fd, 2) = sd->status.allow_party ? 0 : 1; - WFIFOSET(fd, packet_len(0x2c9)); + WFIFOHEAD(fd, sizeof(struct PACKET_ZC_PARTY_CONFIG)); + struct PACKET_ZC_PARTY_CONFIG *p = WFIFOP(fd, 0); + p->packetType = HEADER_ZC_PARTY_CONFIG; + p->denyPartyInvites = sd->status.allow_party ? 1 : 0; + WFIFOSET(fd, sizeof(struct PACKET_ZC_PARTY_CONFIG)); +#endif } /// Party invitation request. @@ -8399,6 +8405,7 @@ static void clif_guild_expulsion(struct map_session_data *sd, const char *name, #endif safestrncpy(&p.reason[0], mes, 40); +// version unconfirmed #if PACKETVER < 20100803 memset(&p.account_name, 0, NAME_LENGTH); // account name (not used for security reasons) #endif @@ -8410,42 +8417,44 @@ static void clif_guild_expulsion(struct map_session_data *sd, const char *name, /// 0163 <packet len>.W { <char name>.24B <reason>.40B }* (PACKETVER >= 20100803) static void clif_guild_expulsionlist(struct map_session_data *sd) { -#if PACKETVER < 20100803 - const int offset = NAME_LENGTH*2+40; -#else - const int offset = NAME_LENGTH+40; -#endif - int fd, i, c = 0; - struct guild* g; - nullpo_retv(sd); - if( (g = sd->guild) == NULL ) + int c = 0; + + struct guild* g; + if ((g = sd->guild) == NULL) return; - fd = sd->fd; + int fd = sd->fd; - WFIFOHEAD(fd,4 + MAX_GUILDEXPULSION * offset); - WFIFOW(fd,0) = 0x163; + WFIFOHEAD(fd, sizeof(struct PACKET_ZC_BAN_LIST) + MAX_GUILDEXPULSION * sizeof(struct PACKET_ZC_BAN_LIST_sub)); + struct PACKET_ZC_BAN_LIST *packet = WFIFOP(fd, 0); + packet->packetType = HEADER_ZC_BAN_LIST; - for( i = 0; i < MAX_GUILDEXPULSION; i++ ) + for (int i = 0; i < MAX_GUILDEXPULSION; i++) { struct guild_expulsion* e = &g->expulsion[i]; - if( e->account_id > 0 ) + if (e->account_id > 0) { - memcpy(WFIFOP(fd,4 + c*offset), e->name, NAME_LENGTH); -#if PACKETVER < 20100803 - memset(WFIFOP(fd,4 + c*offset+24), 0, NAME_LENGTH); // account name (not used for security reasons) - memcpy(WFIFOP(fd,4 + c*offset+48), e->mes, 40); +#if PACKETVER_MAIN_NUM >= 20161019 || PACKETVER_RE_NUM >= 20160921 || defined(PACKETVER_ZERO) + packet->chars[c].char_id = e->char_id; +// version unconfirmed +#elif PACKETVER >= 20100803 + memcpy(packet->chars[c].char_name, e->name, NAME_LENGTH); + #else - memcpy(WFIFOP(fd,4 + c*offset+24), e->mes, 40); + memcpy(packet->chars[c].char_name, e->name, NAME_LENGTH); + memset(packet->chars[c].account_name, 0, NAME_LENGTH); // account name (not used for security reasons) + #endif - c++; + memcpy(packet->chars[c].message, e->mes, 40); + + c ++; } } - WFIFOW(fd,2) = 4 + c*offset; - WFIFOSET(fd,WFIFOW(fd,2)); + packet->packetLen = sizeof(struct PACKET_ZC_BAN_LIST) + c * sizeof(struct PACKET_ZC_BAN_LIST_sub); + WFIFOSET(fd, packet->packetLen); } /// Guild chat message (ZC_GUILD_CHAT). @@ -9226,149 +9235,377 @@ static void clif_refresh(struct map_session_data *sd) clif->refresh_storagewindow(sd); } +static void clif_send_selforarea(int fd, struct block_list *bl, const void *buf, int len) +{ + // if no recipient specified just update nearby clients + // if no recipient specified just update nearby clients + if (fd == 0) { + clif->send(buf, len, bl, AREA); + } else { + struct map_session_data *sd = sockt->session_is_valid(fd) ? sockt->session[fd]->session_data : NULL; + if (sd != NULL) { + clif->send(buf, len, &sd->bl, SELF); + } else { + clif->send(buf, len, bl, SELF); + } + } +} + /// Updates the object's (bl) name on client. /// 0095 <id>.L <char name>.24B (ZC_ACK_REQNAME) /// 0195 <id>.L <char name>.24B <party name>.24B <guild name>.24B <position name>.24B (ZC_ACK_REQNAMEALL) /// 0A30 <id>.L <char name>.24B <party name>.24B <guild name>.24B <position name>.24B <title id>.L (ZC_ACK_REQNAMEALL2) -static void clif_blname_ack(int fd, struct block_list *bl) +static void clif_pcname_ack(int fd, struct block_list *bl) { - struct packet_reqnameall_ack packet = { 0 }; - int len = sizeof(struct packet_reqnameall_ack); - nullpo_retv(bl); + Assert_retv(bl->type == BL_PC); - packet.packet_id = reqName; + struct PACKET_ZC_ACK_REQNAMEALL packet = { 0 }; + int len = sizeof(struct PACKET_ZC_ACK_REQNAMEALL); packet.gid = bl->id; - switch(bl->type) { - case BL_PC: - { - const struct map_session_data *ssd = BL_UCCAST(BL_PC, bl); - const struct party_data *p = NULL; - const struct guild *g = NULL; - int ps = -1; + const struct map_session_data *ssd = BL_UCCAST(BL_PC, bl); + const struct party_data *p = NULL; + const struct guild *g = NULL; + int ps = -1; - if (ssd->fakename[0] != '\0' || ssd->status.guild_id > 0 || ssd->status.party_id > 0 || ssd->status.title_id > 0) { - packet.packet_id = reqNameAllType; - } + if (ssd->fakename[0] != '\0' && ssd->disguise != -1) { + packet.packet_id = HEADER_ZC_ACK_REQNAMEALL; + len = sizeof(struct PACKET_ZC_ACK_REQNAMEALL); + } else { + packet.packet_id = reqName; + len = sizeof(struct packet_reqname_ack); + } - //Requesting your own "shadow" name. [Skotlex] - if (ssd->fd == fd && ssd->disguise != -1) { - packet.gid = -bl->id; - } + //Requesting your own "shadow" name. [Skotlex] + if (ssd->fd == fd && ssd->disguise != -1) { + packet.gid = -bl->id; + } - if (ssd->fakename[0] != '\0') { - memcpy(packet.name, ssd->fakename, NAME_LENGTH); - break; - } + if (ssd->fakename[0] != '\0' && ssd->disguise != -1) { + memcpy(packet.name, ssd->fakename, NAME_LENGTH); + } else { +#if PACKETVER_MAIN_NUM >= 20150225 || PACKETVER_RE_NUM >= 20141126 || defined(PACKETVER_ZERO) + // Title System [Dastgir/Hercules] + if (ssd->status.title_id > 0) { + packet.title_id = ssd->status.title_id; + } +#endif + memcpy(packet.name, ssd->status.name, NAME_LENGTH); -#if PACKETVER >= 20150503 - // Title System [Dastgir/Hercules] - if (ssd->status.title_id > 0) { - packet.title_id = ssd->status.title_id; + if (ssd->status.party_id != 0) { + p = party->search(ssd->status.party_id); + } + if (ssd->status.guild_id != 0) { + if ((g = ssd->guild) != NULL) { + int i; + ARR_FIND(0, g->max_member, i, g->member[i].account_id == ssd->status.account_id && g->member[i].char_id == ssd->status.char_id); + if (i < g->max_member) + ps = g->member[i].position; } + } + + if (!battle_config.display_party_name && g == NULL) { + // do not display party unless the player is also in a guild + p = NULL; + } + + if (p != NULL) { + memcpy(packet.party_name, p->party.name, NAME_LENGTH); + } + + if (g != NULL && ps >= 0 && ps < MAX_GUILDPOSITION) { + memcpy(packet.guild_name, g->name,NAME_LENGTH); + memcpy(packet.position_name, g->position[ps].name, NAME_LENGTH); + } + } + + clif->send_selforarea(fd, bl, &packet, len); +} + +/// Updates the object's (bl) name on client. +/// 0095 <id>.L <char name>.24B (ZC_ACK_REQNAME) +/// 0195 <id>.L <char name>.24B <party name>.24B <guild name>.24B <position name>.24B (ZC_ACK_REQNAMEALL) +/// 0A30 <id>.L <char name>.24B <party name>.24B <guild name>.24B <position name>.24B <title id>.L (ZC_ACK_REQNAMEALL2) +static void clif_homname_ack(int fd, struct block_list *bl) +{ + nullpo_retv(bl); + Assert_retv(bl->type == BL_HOM); + + struct PACKET_ZC_ACK_REQNAME_TITLE packet = { 0 }; + packet.packet_id = HEADER_ZC_ACK_REQNAME_TITLE; + packet.gid = bl->id; + memcpy(packet.name, BL_UCCAST(BL_HOM, bl)->homunculus.name, NAME_LENGTH); +#if PACKETVER_MAIN_NUM >= 20180207 || PACKETVER_RE_NUM >= 20171129 || PACKETVER_ZERO_NUM >= 20171130 + struct unit_data *ud = unit->bl2ud(bl); + if (ud != NULL) { + memcpy(packet.title, ud->title, NAME_LENGTH); + packet.groupId = ud->groupId; + } #endif - memcpy(packet.name, ssd->status.name, NAME_LENGTH); + clif->send_selforarea(fd, bl, &packet, sizeof(struct PACKET_ZC_ACK_REQNAME_TITLE)); +} - if (ssd->status.party_id != 0) { - p = party->search(ssd->status.party_id); - } - if (ssd->status.guild_id != 0) { - if ((g = ssd->guild) != NULL) { - int i; - ARR_FIND(0, g->max_member, i, g->member[i].account_id == ssd->status.account_id && g->member[i].char_id == ssd->status.char_id); - if (i < g->max_member) - ps = g->member[i].position; - } - } +/// Updates the object's (bl) name on client. +/// 0095 <id>.L <char name>.24B (ZC_ACK_REQNAME) +/// 0195 <id>.L <char name>.24B <party name>.24B <guild name>.24B <position name>.24B (ZC_ACK_REQNAMEALL) +/// 0A30 <id>.L <char name>.24B <party name>.24B <guild name>.24B <position name>.24B <title id>.L (ZC_ACK_REQNAMEALL2) +static void clif_mername_ack(int fd, struct block_list *bl) +{ + nullpo_retv(bl); + Assert_retv(bl->type == BL_MER); - if (!battle_config.display_party_name && g == NULL) { - // do not display party unless the player is also in a guild - p = NULL; - } + struct PACKET_ZC_ACK_REQNAME_TITLE packet = { 0 }; + packet.packet_id = HEADER_ZC_ACK_REQNAME_TITLE; + packet.gid = bl->id; + memcpy(packet.name, BL_UCCAST(BL_MER, bl)->db->name, NAME_LENGTH); +#if PACKETVER_MAIN_NUM >= 20180207 || PACKETVER_RE_NUM >= 20171129 || PACKETVER_ZERO_NUM >= 20171130 + struct unit_data *ud = unit->bl2ud(bl); + if (ud != NULL) { + memcpy(packet.title, ud->title, NAME_LENGTH); + packet.groupId = ud->groupId; + } +#endif - if (p == NULL && g == NULL) - break; + clif->send_selforarea(fd, bl, &packet, sizeof(struct PACKET_ZC_ACK_REQNAME_TITLE)); +} - if (p != NULL) { - memcpy(packet.party_name, p->party.name, NAME_LENGTH); - } +/// Updates the object's (bl) name on client. +/// 0095 <id>.L <char name>.24B (ZC_ACK_REQNAME) +/// 0195 <id>.L <char name>.24B <party name>.24B <guild name>.24B <position name>.24B (ZC_ACK_REQNAMEALL) +/// 0A30 <id>.L <char name>.24B <party name>.24B <guild name>.24B <position name>.24B <title id>.L (ZC_ACK_REQNAMEALL2) +static void clif_petname_ack(int fd, struct block_list *bl) +{ + nullpo_retv(bl); + Assert_retv(bl->type == BL_PET); - if (g != NULL && ps >= 0 && ps < MAX_GUILDPOSITION) { - memcpy(packet.guild_name, g->name,NAME_LENGTH); - memcpy(packet.position_name, g->position[ps].name, NAME_LENGTH); - } - } + struct PACKET_ZC_ACK_REQNAME_TITLE packet = { 0 }; + packet.packet_id = HEADER_ZC_ACK_REQNAME_TITLE; + packet.gid = bl->id; + memcpy(packet.name, BL_UCCAST(BL_PET, bl)->pet.name, NAME_LENGTH); +#if PACKETVER_MAIN_NUM >= 20180207 || PACKETVER_RE_NUM >= 20171129 || PACKETVER_ZERO_NUM >= 20171130 + struct unit_data *ud = unit->bl2ud(bl); + if (ud != NULL) { + memcpy(packet.title, ud->title, NAME_LENGTH); + packet.groupId = ud->groupId; + } +#endif + + clif->send_selforarea(fd, bl, &packet, sizeof(struct PACKET_ZC_ACK_REQNAME_TITLE)); +} + +/// Updates the object's (bl) name on client. +/// 0095 <id>.L <char name>.24B (ZC_ACK_REQNAME) +/// 0195 <id>.L <char name>.24B <party name>.24B <guild name>.24B <position name>.24B (ZC_ACK_REQNAMEALL) +/// 0A30 <id>.L <char name>.24B <party name>.24B <guild name>.24B <position name>.24B <title id>.L (ZC_ACK_REQNAMEALL2) +static void clif_npcname_ack(int fd, struct block_list *bl) +{ + nullpo_retv(bl); + Assert_retv(bl->type == BL_NPC); + + struct PACKET_ZC_ACK_REQNAME_TITLE packet = { 0 }; + packet.packet_id = HEADER_ZC_ACK_REQNAME_TITLE; + packet.gid = bl->id; + memcpy(packet.name, BL_UCCAST(BL_NPC, bl)->name, NAME_LENGTH); +#if PACKETVER_MAIN_NUM >= 20180207 || PACKETVER_RE_NUM >= 20171129 || PACKETVER_ZERO_NUM >= 20171130 + struct unit_data *ud = unit->bl2ud(bl); + if (ud != NULL) { + memcpy(packet.title, ud->title, NAME_LENGTH); + packet.groupId = ud->groupId; + } +#endif + + clif->send_selforarea(fd, bl, &packet, sizeof(struct PACKET_ZC_ACK_REQNAME_TITLE)); +} + +/// Updates the object's (bl) name on client. +/// 0095 <id>.L <char name>.24B (ZC_ACK_REQNAME) +/// 0195 <id>.L <char name>.24B <party name>.24B <guild name>.24B <position name>.24B (ZC_ACK_REQNAMEALL) +/// 0A30 <id>.L <char name>.24B <party name>.24B <guild name>.24B <position name>.24B <title id>.L (ZC_ACK_REQNAMEALL2) +static void clif_mobname_guardian_ack(int fd, struct block_list *bl) +{ + nullpo_retv(bl); + Assert_retv(bl->type == BL_MOB); + const struct mob_data *md = BL_UCCAST(BL_MOB, bl); + Assert_retv(md->guardian_data && md->guardian_data->g); + + struct PACKET_ZC_ACK_REQNAMEALL packet = { 0 }; + packet.packet_id = HEADER_ZC_ACK_REQNAMEALL; + packet.gid = bl->id; + memcpy(packet.name, md->name, NAME_LENGTH); + memcpy(packet.guild_name, md->guardian_data->g->name, NAME_LENGTH); + memcpy(packet.position_name, md->guardian_data->castle->castle_name, NAME_LENGTH); + clif->send_selforarea(fd, bl, &packet, sizeof(struct PACKET_ZC_ACK_REQNAMEALL)); +} + +/// Updates the object's (bl) name on client. +/// 0095 <id>.L <char name>.24B (ZC_ACK_REQNAME) +/// 0195 <id>.L <char name>.24B <party name>.24B <guild name>.24B <position name>.24B (ZC_ACK_REQNAMEALL) +/// 0A30 <id>.L <char name>.24B <party name>.24B <guild name>.24B <position name>.24B <title id>.L (ZC_ACK_REQNAMEALL2) +static void clif_mobname_normal_ack(int fd, struct block_list *bl) +{ + nullpo_retv(bl); + Assert_retv(bl->type == BL_MOB); + + struct PACKET_ZC_ACK_REQNAME_TITLE packet = { 0 }; + packet.packet_id = HEADER_ZC_ACK_REQNAME_TITLE; + packet.gid = bl->id; + memcpy(packet.name, BL_UCCAST(BL_MOB, bl)->db->name, NAME_LENGTH); +#if PACKETVER_MAIN_NUM >= 20180207 || PACKETVER_RE_NUM >= 20171129 || PACKETVER_ZERO_NUM >= 20171130 + struct unit_data *ud = unit->bl2ud(bl); + if (ud != NULL) { + memcpy(packet.title, ud->title, NAME_LENGTH); + packet.groupId = ud->groupId; + } +#endif + + clif->send_selforarea(fd, bl, &packet, sizeof(struct PACKET_ZC_ACK_REQNAME_TITLE)); +} + +/// Updates the object's (bl) name on client. +/// 0095 <id>.L <char name>.24B (ZC_ACK_REQNAME) +/// 0195 <id>.L <char name>.24B <party name>.24B <guild name>.24B <position name>.24B (ZC_ACK_REQNAMEALL) +/// 0A30 <id>.L <char name>.24B <party name>.24B <guild name>.24B <position name>.24B <title id>.L (ZC_ACK_REQNAMEALL2) +static void clif_mobname_additional_ack(int fd, struct block_list *bl) +{ + nullpo_retv(bl); + Assert_retv(bl->type == BL_MOB); + + struct PACKET_ZC_ACK_REQNAMEALL packet = { 0 }; + packet.packet_id = HEADER_ZC_ACK_REQNAMEALL; + packet.gid = bl->id; + + const struct mob_data *md = BL_UCCAST(BL_MOB, bl); + + memcpy(packet.name, md->name, NAME_LENGTH); + char mobhp[100]; + char *str_p = mobhp; + if (battle_config.show_mob_info&4) + str_p += sprintf(str_p, "Lv. %d | ", md->level); + if (battle_config.show_mob_info&1) + str_p += sprintf(str_p, "HP: %u/%u | ", md->status.hp, md->status.max_hp); + if (battle_config.show_mob_info&2) + str_p += sprintf(str_p, "HP: %u%% | ", get_percentage(md->status.hp, md->status.max_hp)); + //Even thought mobhp ain't a name, we send it as one so the client + //can parse it. [Skotlex] + if (str_p != mobhp) { + *(str_p-3) = '\0'; //Remove trailing space + pipe. + memcpy(packet.party_name, mobhp, NAME_LENGTH); + } + + clif->send_selforarea(fd, bl, &packet, sizeof(struct PACKET_ZC_ACK_REQNAMEALL)); +} + +/// Updates the object's (bl) name on client. +/// 0095 <id>.L <char name>.24B (ZC_ACK_REQNAME) +/// 0195 <id>.L <char name>.24B <party name>.24B <guild name>.24B <position name>.24B (ZC_ACK_REQNAMEALL) +/// 0A30 <id>.L <char name>.24B <party name>.24B <guild name>.24B <position name>.24B <title id>.L (ZC_ACK_REQNAMEALL2) +static void clif_mobname_ack(int fd, struct block_list *bl) +{ + nullpo_retv(bl); + Assert_retv(bl->type == BL_MOB); + + const struct mob_data *md = BL_UCCAST(BL_MOB, bl); + + if (md->guardian_data && md->guardian_data->g) { + clif->mobname_guardian_ack(fd, bl); + } else if (battle_config.show_mob_info) { + clif->mobname_additional_ack(fd, bl); + } else { + clif->mobname_normal_ack(fd, bl); + } +} + +/// Updates the object's (bl) name on client. +/// 0095 <id>.L <char name>.24B (ZC_ACK_REQNAME) +/// 0195 <id>.L <char name>.24B <party name>.24B <guild name>.24B <position name>.24B (ZC_ACK_REQNAMEALL) +/// 0A30 <id>.L <char name>.24B <party name>.24B <guild name>.24B <position name>.24B <title id>.L (ZC_ACK_REQNAMEALL2) +static void clif_chatname_ack(int fd, struct block_list *bl) +{ + nullpo_retv(bl); + Assert_retv(bl->type == BL_CHAT); + + struct PACKET_ZC_ACK_REQNAME_TITLE packet = { 0 }; + packet.packet_id = HEADER_ZC_ACK_REQNAME_TITLE; + packet.gid = bl->id; + +#if 0 // Clients DO request this... what should be done about it? The chat's title may not fit... [Skotlex] + memcpy(packet.name, BL_UCCAST(BL_CHAT, bl)->title, NAME_LENGTH); +#if PACKETVER_MAIN_NUM >= 20180207 || PACKETVER_RE_NUM >= 20171129 || PACKETVER_ZERO_NUM >= 20171130 + struct unit_data *ud = unit->bl2ud(bl); + if (ud != NULL) { + memcpy(packet.title, ud->title, NAME_LENGTH); + packet.groupId = ud->groupId; + } +#endif +#endif + + clif->send_selforarea(fd, bl, &packet, sizeof(struct PACKET_ZC_ACK_REQNAME_TITLE)); +} + +/// Updates the object's (bl) name on client. +/// 0095 <id>.L <char name>.24B (ZC_ACK_REQNAME) +/// 0195 <id>.L <char name>.24B <party name>.24B <guild name>.24B <position name>.24B (ZC_ACK_REQNAMEALL) +/// 0A30 <id>.L <char name>.24B <party name>.24B <guild name>.24B <position name>.24B <title id>.L (ZC_ACK_REQNAMEALL2) +static void clif_elemname_ack(int fd, struct block_list *bl) +{ + nullpo_retv(bl); + Assert_retv(bl->type == BL_ELEM); + + struct PACKET_ZC_ACK_REQNAME_TITLE packet = { 0 }; + packet.packet_id = HEADER_ZC_ACK_REQNAME_TITLE; + packet.gid = bl->id; + memcpy(packet.name, BL_UCCAST(BL_ELEM, bl)->db->name, NAME_LENGTH); +#if PACKETVER_MAIN_NUM >= 20180207 || PACKETVER_RE_NUM >= 20171129 || PACKETVER_ZERO_NUM >= 20171130 + struct unit_data *ud = unit->bl2ud(bl); + if (ud != NULL) { + memcpy(packet.title, ud->title, NAME_LENGTH); + packet.groupId = ud->groupId; + } +#endif + + clif->send_selforarea(fd, bl, &packet, sizeof(struct PACKET_ZC_ACK_REQNAME_TITLE)); +} + +static void clif_unknownname_ack(int fd, struct block_list *bl) +{ + nullpo_retv(bl); + ShowError("clif_blname_ack: bad type %u(%d)\n", bl->type, bl->id); +} + +static void clif_blname_ack(int fd, struct block_list *bl) +{ + nullpo_retv(bl); + + switch(bl->type) { + case BL_PC: + clif->pcname_ack(fd, bl); break; - //[blackhole89] case BL_HOM: - memcpy(packet.name, BL_UCCAST(BL_HOM, bl)->homunculus.name, NAME_LENGTH); + clif->homname_ack(fd, bl); break; case BL_MER: - memcpy(packet.name, BL_UCCAST(BL_MER, bl)->db->name, NAME_LENGTH); + clif->mername_ack(fd, bl); break; case BL_PET: - memcpy(packet.name, BL_UCCAST(BL_PET, bl)->pet.name, NAME_LENGTH); + clif->petname_ack(fd, bl); break; case BL_NPC: - memcpy(packet.name, BL_UCCAST(BL_NPC, bl)->name, NAME_LENGTH); + clif->npcname_ack(fd, bl); break; case BL_MOB: - { - const struct mob_data *md = BL_UCCAST(BL_MOB, bl); - - memcpy(packet.name, md->name, NAME_LENGTH); - if (md->guardian_data && md->guardian_data->g) { - packet.packet_id = reqNameAllType; - memcpy(packet.guild_name, md->guardian_data->g->name, NAME_LENGTH); - memcpy(packet.position_name, md->guardian_data->castle->castle_name, NAME_LENGTH); - } else if (battle_config.show_mob_info) { - char mobhp[50], *str_p = mobhp; - packet.packet_id = reqNameAllType; - if (battle_config.show_mob_info&4) - str_p += sprintf(str_p, "Lv. %d | ", md->level); - if (battle_config.show_mob_info&1) - str_p += sprintf(str_p, "HP: %u/%u | ", md->status.hp, md->status.max_hp); - if (battle_config.show_mob_info&2) - str_p += sprintf(str_p, "HP: %u%% | ", get_percentage(md->status.hp, md->status.max_hp)); - //Even thought mobhp ain't a name, we send it as one so the client - //can parse it. [Skotlex] - if (str_p != mobhp) { - *(str_p-3) = '\0'; //Remove trailing space + pipe. - memcpy(packet.party_name, mobhp, NAME_LENGTH); - } - } - } + clif->mobname_ack(fd, bl); break; case BL_CHAT: -#if 0 //FIXME: Clients DO request this... what should be done about it? The chat's title may not fit... [Skotlex] - memcpy(packet.name, BL_UCCAST(BL_CHAT, bl)->title, NAME_LENGTH); + clif->chatname_ack(fd, bl); break; -#endif - return; case BL_ELEM: - memcpy(packet.name, BL_UCCAST(BL_ELEM, bl)->db->name, NAME_LENGTH); + clif->elemname_ack(fd, bl); break; default: - ShowError("clif_blname_ack: bad type %u(%d)\n", bl->type, bl->id); - return; - } - - if (packet.packet_id == reqName) { - len = sizeof(struct packet_reqname_ack); - } - // if no recipient specified just update nearby clients - // if no recipient specified just update nearby clients - if (fd == 0) { - clif->send(&packet, len, bl, AREA); - } else { - struct map_session_data *sd = sockt->session_is_valid(fd) ? sockt->session[fd]->session_data : NULL; - if (sd != NULL) { - clif->send(&packet, len, &sd->bl, SELF); - } else { - clif->send(&packet, len, bl, SELF); - } + clif->unknownname_ack(fd, bl); + break; } } @@ -9379,14 +9616,14 @@ static void clif_charnameupdate(struct map_session_data *ssd) int ps = -1; struct party_data *p = NULL; struct guild *g = NULL; - struct packet_reqnameall_ack packet = { 0 }; + struct PACKET_ZC_ACK_REQNAMEALL packet = { 0 }; nullpo_retv(ssd); if (ssd->fakename[0]) return; //No need to update as the party/guild was not displayed anyway. - packet.packet_id = reqNameAllType; + packet.packet_id = HEADER_ZC_ACK_REQNAMEALL; packet.gid = ssd->bl.id; memcpy(packet.name, ssd->status.name, NAME_LENGTH); @@ -9413,7 +9650,7 @@ static void clif_charnameupdate(struct map_session_data *ssd) memcpy(packet.position_name, g->position[ps].name, NAME_LENGTH); } -#if PACKETVER >= 20150503 +#if PACKETVER_MAIN_NUM >= 20150225 || PACKETVER_RE_NUM >= 20141126 || defined(PACKETVER_ZERO) // Achievement System [Dastgir/Hercules] if (ssd->status.title_id > 0) { packet.title_id = ssd->status.title_id; @@ -10742,8 +10979,10 @@ static void clif_parse_QuitGame(int fd, struct map_session_data *sd) /* Rovert's prevent logout option fixed [Valaris] */ if (!sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] && !sd->sc.data[SC_CLOAKINGEXCEED] && !sd->sc.data[SC__INVISIBILITY] && !sd->sc.data[SC_SUHIDE] && (!battle_config.prevent_logout || DIFF_TICK(timer->gettick(), sd->canlog_tick) > battle_config.prevent_logout)) { - sockt->eof(fd); clif->disconnect_ack(sd, 0); + sockt->flush(fd); + if (battle_config.drop_connection_on_quit) + sockt->eof(fd); } else { clif->disconnect_ack(sd, 1); } @@ -11535,7 +11774,7 @@ static void clif_parse_NpcClicked(int fd, struct map_session_data *sd) #endif return; } - if ( pc_cant_act2(sd) || !(bl = map->id2bl(RFIFOL(fd,2))) || sd->state.vending ) + if (pc_cant_act2(sd) || !(bl = map->id2bl(RFIFOL(fd,2))) || sd->state.vending || sd->state.prevend) return; switch (bl->type) { @@ -11907,7 +12146,7 @@ static void clif_parse_PutItemToCart(int fd, struct map_session_data *sd) __attr static void clif_parse_PutItemToCart(int fd, struct map_session_data *sd) { int flag = 0; - if (pc_istrading(sd)) + if (pc_istrading(sd) || sd->state.prevend) return; if (!pc_iscarton(sd)) return; @@ -11922,6 +12161,8 @@ static void clif_parse_GetItemFromCart(int fd, struct map_session_data *sd) __at /// 0127 <index>.W <amount>.L static void clif_parse_GetItemFromCart(int fd, struct map_session_data *sd) { + if (pc_istrading(sd) || sd->state.prevend) + return; if (!pc_iscarton(sd)) return; pc->getitemfromcart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4)); @@ -12796,7 +13037,7 @@ static void clif_parse_MoveToKafra(int fd, struct map_session_data *sd) { int item_index, item_amount; - if (pc_istrading(sd)) + if (pc_istrading(sd) || sd->state.prevend) return; item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; @@ -12817,6 +13058,9 @@ static void clif_parse_MoveFromKafra(int fd, struct map_session_data *sd) __attr /// There are various variants of this packet, some of them have padding between fields. static void clif_parse_MoveFromKafra(int fd, struct map_session_data *sd) { + if (pc_istrading(sd) || sd->state.prevend) + return; + int item_index, item_amount; item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-1; @@ -12833,7 +13077,7 @@ static void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd) /// 0129 <index>.W <amount>.L static void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd) { - if( sd->state.vending ) + if (pc_istrading(sd) || sd->state.prevend) return; if (!pc_iscarton(sd)) return; @@ -12849,7 +13093,7 @@ static void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd) /// 0128 <index>.W <amount>.L static void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd) { - if( sd->state.vending ) + if (pc_istrading(sd) || sd->state.prevend) return; if (!pc_iscarton(sd)) return; @@ -16340,7 +16584,7 @@ static void clif_Auction_openwindow(struct map_session_data *sd) nullpo_retv(sd); fd = sd->fd; - if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->state.vending || sd->state.buyingstore || sd->state.trading) + if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->state.vending || sd->state.prevend || sd->state.buyingstore || sd->state.trading) return; if( !battle_config.feature_auction ) @@ -17031,7 +17275,14 @@ static void clif_parse_PartyTick(int fd, struct map_session_data *sd) __attribut static void clif_parse_PartyTick(int fd, struct map_session_data *sd) { const struct PACKET_CZ_PARTY_CONFIG *const p = RFIFOP(fd, 0); - sd->status.allow_party = p->refuseInvite ? false : true; + const bool newAllowParty = p->refuseInvite ? true : false; + if (newAllowParty != sd->status.allow_party) { + sd->status.allow_party = newAllowParty; + if ((map->save_settings & 512) != 0) + chrif->save(sd, 0); // send to char server + } else { + sd->status.allow_party = newAllowParty; + } clif->partytickack(sd, sd->status.allow_party); } @@ -18923,7 +19174,7 @@ static void clif_parse_SkillSelectMenu(int fd, struct map_session_data *sd) if( sd->menuskill_id != SC_AUTOSHADOWSPELL ) return; - if( pc_istrading(sd) ) { + if (pc_istrading(sd) || sd->state.prevend) { clif->skill_fail(sd, sd->ud.skill_id, 0, 0, 0); clif_menuskill_clear(sd); return; @@ -19272,18 +19523,24 @@ static void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) } else { result = CSBR_UNKONWN_ITEM; } - - WFIFOHEAD(fd, 16); - WFIFOW(fd, 0) = 0x849; - WFIFOL(fd, 2) = id; - WFIFOW(fd, 6) = result;/* result */ - WFIFOL(fd, 8) = sd->cashPoints;/* current cash point */ - WFIFOL(fd, 12) = sd->kafraPoints;// [Ryuuzaki] - WFIFOSET(fd, 16); + clif->cashShopBuyAck(fd, sd, id, result); } } +static void clif_cashShopBuyAck(int fd, struct map_session_data *sd, int itemId, enum CASH_SHOP_BUY_RESULT result) +{ + nullpo_retv(sd); + WFIFOHEAD(fd, sizeof(struct PACKET_ZC_SE_PC_BUY_CASHITEM_RESULT)); + struct PACKET_ZC_SE_PC_BUY_CASHITEM_RESULT *p = WFIFOP(fd, 0); + p->packetType = 0x849; + p->itemId = itemId; + p->result = result; + p->cashPoints = sd->cashPoints; + p->kafraPoints = sd->kafraPoints; + WFIFOSET(fd, sizeof(struct PACKET_ZC_SE_PC_BUY_CASHITEM_RESULT)); +} + static void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /* [Ind/Hercules] */ static void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) @@ -20309,20 +20566,34 @@ static void clif_roulette_generate_ack(struct map_session_data *sd, enum GENERAT #endif } +static void clif_roulette_close(struct map_session_data *sd) +{ +#if PACKETVER_MAIN_NUM >= 20141008 || PACKETVER_RE_NUM >= 20140903 || defined(PACKETVER_ZERO) + nullpo_retv(sd); + + struct PACKET_ZC_ACK_CLOSE_ROULETTE p; + p.packetType = HEADER_ZC_ACK_CLOSE_ROULETTE; + p.result = 0; // close window + + clif->send(&p, sizeof(p), &sd->bl, SELF); +#endif +} + /** * Stackable items merger */ static void clif_openmergeitem(int fd, struct map_session_data *sd) { -#if PACKETVER > 20120228 - int i = 0, n = 0, j = 0; +#if PACKETVER_MAIN_NUM >= 20120314 || PACKETVER_RE_NUM >= 20120221 || defined(PACKETVER_ZERO) + nullpo_retv(sd); + + int n = 0, j = 0; struct merge_item merge_items[MAX_INVENTORY]; struct merge_item *merge_items_[MAX_INVENTORY] = {0}; - nullpo_retv(sd); - memset(&merge_items,'\0',sizeof(merge_items)); + memset(&merge_items, '\0', sizeof(merge_items)); - for (i = 0; i < sd->status.inventorySize; i++) { + for (int i = 0; i < sd->status.inventorySize; i++) { struct item *item_data = &sd->status.inventory[i]; if (item_data->nameid == 0 || !itemdb->isstackable(item_data->nameid) || item_data->bound != IBT_NONE) @@ -20333,17 +20604,18 @@ static void clif_openmergeitem(int fd, struct map_session_data *sd) n++; } - qsort(merge_items,n,sizeof(struct merge_item),clif->comparemergeitem); + qsort(merge_items, n, sizeof(struct merge_item), clif->comparemergeitem); - for (i = 0, j = 0; i < n; i++) { - if (i > 0 && merge_items[i].nameid == merge_items[i-1].nameid) + j = 0; + for (int i = 0; i < n; i++) { + if (i > 0 && merge_items[i].nameid == merge_items[i - 1].nameid) { merge_items_[j] = &merge_items[i]; j++; continue; } - if (i < n - 1 && merge_items[i].nameid == merge_items[i+1].nameid) + if (i < n - 1 && merge_items[i].nameid == merge_items[i + 1].nameid) { merge_items_[j] = &merge_items[i]; j++; @@ -20351,12 +20623,14 @@ static void clif_openmergeitem(int fd, struct map_session_data *sd) } } - WFIFOHEAD(fd,2*j+4); - WFIFOW(fd,0) = 0x96d; - WFIFOW(fd,2) = 2*j+4; - for ( i = 0; i < j; i++ ) - WFIFOW(fd,i*2+4) = merge_items_[i]->position; - WFIFOSET(fd,2*j+4); + const int len = sizeof(struct PACKET_ZC_MERGE_ITEM_OPEN) + j * sizeof(struct PACKET_ZC_MERGE_ITEM_OPEN_sub); + WFIFOHEAD(fd, len); + struct PACKET_ZC_MERGE_ITEM_OPEN *p = WFIFOP(fd, 0); + p->packetType = HEADER_ZC_MERGE_ITEM_OPEN; + p->packetLen = len; + for (int i = 0; i < j; i++) + p->items[i].index = merge_items_[i]->position; + WFIFOSET(fd, len); #endif } @@ -20372,35 +20646,42 @@ static int clif_comparemergeitem(const void *a, const void *b) return a_->nameid > b_->nameid ? -1 : 1; } +static void clif_mergeitems(int fd, struct map_session_data *sd, int index, int amount, enum mergeitem_reason reason) +{ +#if PACKETVER_MAIN_NUM >= 20120314 || PACKETVER_RE_NUM >= 20120221 || defined(PACKETVER_ZERO) + WFIFOHEAD(fd, sizeof(struct PACKET_ZC_ACK_MERGE_ITEM)); + struct PACKET_ZC_ACK_MERGE_ITEM *p = WFIFOP(fd, 0); + p->packetType = HEADER_ZC_ACK_MERGE_ITEM; + p->index = index + 2; + p->amount = amount; + p->reason = reason; + WFIFOSET(fd, sizeof(struct PACKET_ZC_ACK_MERGE_ITEM)); +#endif +} + static void clif_ackmergeitems(int fd, struct map_session_data *sd) { -#if PACKETVER > 20120228 - int i = 0, n = 0, length = 0, count = 0; +#if PACKETVER_MAIN_NUM >= 20120314 || PACKETVER_RE_NUM >= 20120221 || defined(PACKETVER_ZERO) + nullpo_retv(sd); + + int i = 0, n = 0, count = 0; int nameid = 0; int16 indexes[MAX_INVENTORY] = {0}, amounts[MAX_INVENTORY] = {0}; - struct item item_data; - nullpo_retv(sd); - length = (RFIFOW(fd,2) - 4)/2; + int length = (RFIFOW(fd, 2) - 4) / 2; if (length >= sd->status.inventorySize || length < 2) { - WFIFOHEAD(fd,7); - WFIFOW(fd,0) = 0x96f; - WFIFOW(fd,2) = 0; - WFIFOW(fd,4) = 0; - WFIFOB(fd,6) = MERGEITEM_FAILD; - WFIFOSET(fd,7); + clif->mergeitems(fd, sd, 0, 0, MERGEITEM_FAILD); return; } for (i = 0, n = 0; i < length; i++) { - int16 idx = RFIFOW(fd,i*2+4) - 2; - struct item *it = NULL; + int16 idx = RFIFOW(fd, i * 2 + 4) - 2; if (idx < 0 || idx >= sd->status.inventorySize) continue; - it = &sd->status.inventory[idx]; + struct item *it = &sd->status.inventory[idx]; if (it->nameid == 0 || !itemdb->isstackable(it->nameid) || it->bound != IBT_NONE) continue; @@ -20418,43 +20699,29 @@ static void clif_ackmergeitems(int fd, struct map_session_data *sd) } if (n < 2 || count == 0) { - WFIFOHEAD(fd,7); - WFIFOW(fd,0) = 0x96f; - WFIFOW(fd,2) = 0; - WFIFOW(fd,4) = 0; - WFIFOB(fd,6) = MERGEITEM_FAILD; - WFIFOSET(fd,7); + clif->mergeitems(fd, sd, 0, 0, MERGEITEM_FAILD); return; } if (count > MAX_AMOUNT) { - WFIFOHEAD(fd,7); - WFIFOW(fd,0) = 0x96f; - WFIFOW(fd,2) = 0; - WFIFOW(fd,4) = 0; - WFIFOB(fd,6) = MERGEITEM_MAXCOUNTFAILD; - WFIFOSET(fd,7); + clif->mergeitems(fd, sd, 0, 0, MERGEITEM_MAXCOUNTFAILD); return; } for (i = 0; i < n; i++) - pc->delitem(sd,indexes[i],amounts[i],0,DELITEM_NORMAL,LOG_TYPE_NPC); + pc->delitem(sd, indexes[i], amounts[i], 0, DELITEM_NORMAL, LOG_TYPE_NPC); - memset(&item_data,'\0',sizeof(item_data)); + struct item item_data; + memset(&item_data, '\0', sizeof(item_data)); item_data.nameid = nameid; item_data.identify = 1; item_data.unique_id = itemdb->unique_id(sd); - pc->additem(sd,&item_data,count,LOG_TYPE_NPC); + pc->additem(sd, &item_data, count, LOG_TYPE_NPC); ARR_FIND(0, sd->status.inventorySize, i, item_data.unique_id == sd->status.inventory[i].unique_id); - WFIFOHEAD(fd,7); - WFIFOW(fd,0) = 0x96f; - WFIFOW(fd,2) = i+2; - WFIFOW(fd,4) = count; - WFIFOB(fd,6) = MERGEITEM_SUCCESS; - WFIFOSET(fd,7); + clif->mergeitems(fd, sd, i, count, MERGEITEM_SUCCESS); #endif } @@ -21835,6 +22102,17 @@ static void clif_parse_attendance_reward_request(int fd, struct map_session_data static void clif_parse_cz_blocking_play_cancel(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); static void clif_parse_cz_blocking_play_cancel(int fd, struct map_session_data *sd) { + clif->loadConfirm(sd); +} + +static void clif_loadConfirm(struct map_session_data *sd) +{ +#if PACKETVER_MAIN_NUM >= 20190403 || PACKETVER_RE_NUM >= 20190320 || PACKETVER_ZERO_NUM >= 20190410 + nullpo_retv(sd); + struct PACKET_ZC_LOAD_CONFIRM p; + p.packetType = HEADER_ZC_LOAD_CONFIRM; + clif->send(&p, sizeof(p), &sd->bl, SELF); +#endif } static void clif_ui_action(struct map_session_data *sd, int32 UIType, int32 data) @@ -22699,6 +22977,18 @@ void clif_defaults(void) clif->mvp_noitem = clif_mvp_noitem; clif->changed_dir = clif_changed_dir; clif->blname_ack = clif_blname_ack; + clif->pcname_ack = clif_pcname_ack; + clif->homname_ack = clif_homname_ack; + clif->mername_ack = clif_mername_ack; + clif->petname_ack = clif_petname_ack; + clif->npcname_ack = clif_npcname_ack; + clif->mobname_ack = clif_mobname_ack; + clif->mobname_guardian_ack = clif_mobname_guardian_ack; + clif->mobname_additional_ack = clif_mobname_additional_ack; + clif->mobname_normal_ack = clif_mobname_normal_ack; + clif->chatname_ack = clif_chatname_ack; + clif->elemname_ack = clif_elemname_ack; + clif->unknownname_ack = clif_unknownname_ack; clif->monster_hp_bar = clif_monster_hp_bar; clif->hpmeter = clif_hpmeter; clif->hpmeter_single = clif_hpmeter_single; @@ -22796,6 +23086,7 @@ void clif_defaults(void) clif->joinchatok = clif_joinchatok; clif->addchat = clif_addchat; clif->changechatowner = clif_changechatowner; + clif->chatRoleChange = clif_chatRoleChange; clif->clearchat = clif_clearchat; clif->leavechat = clif_leavechat; clif->changechatstatus = clif_changechatstatus; @@ -23058,11 +23349,13 @@ void clif_defaults(void) /* */ clif->parse_roulette_db = clif_parse_roulette_db; clif->roulette_generate_ack = clif_roulette_generate_ack; + clif->roulette_close = clif_roulette_close; /* Merge Items */ clif->openmergeitem = clif_openmergeitem; clif->cancelmergeitem = clif_cancelmergeitem; clif->comparemergeitem = clif_comparemergeitem; clif->ackmergeitems = clif_ackmergeitems; + clif->mergeitems = clif_mergeitems; /* Cart Deco */ clif->selectcart = clif_selectcart; /* */ @@ -23298,6 +23591,7 @@ void clif_defaults(void) clif->pCashShopReqTab = clif_parse_CashShopReqTab; clif->pCashShopSchedule = clif_parse_CashShopSchedule; clif->pCashShopBuy = clif_parse_CashShopBuy; + clif->cashShopBuyAck = clif_cashShopBuyAck; /* */ clif->pPartyTick = clif_parse_PartyTick; clif->pGuildInvite2 = clif_parse_GuildInvite2; @@ -23409,4 +23703,6 @@ void clif_defaults(void) clif->pingTimer = clif_pingTimer; clif->pingTimerSub = clif_pingTimerSub; clif->pResetCooldown = clif_parse_ResetCooldown; + clif->loadConfirm = clif_loadConfirm; + clif->send_selforarea = clif_send_selforarea; } diff --git a/src/map/clif.h b/src/map/clif.h index b3441f908..aaf053274 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -410,6 +410,7 @@ enum CASH_SHOP_BUY_RESULT { CSBR_RUNE_OVERCOUNT = 0x9, CSBR_EACHITEM_OVERCOUNT = 0xa, CSBR_UNKNOWN = 0xb, + CSBR_BUSY = 0xc, }; enum BATTLEGROUNDS_QUEUE_ACK { @@ -889,6 +890,18 @@ struct clif_interface { void (*mvp_noitem) (struct map_session_data* sd); void (*changed_dir) (struct block_list *bl, enum send_target target); void (*blname_ack) (int fd, struct block_list *bl); + void (*pcname_ack) (int fd, struct block_list *bl); + void (*homname_ack) (int fd, struct block_list *bl); + void (*mername_ack) (int fd, struct block_list *bl); + void (*petname_ack) (int fd, struct block_list *bl); + void (*npcname_ack) (int fd, struct block_list *bl); + void (*mobname_ack) (int fd, struct block_list *bl); + void (*mobname_guardian_ack) (int fd, struct block_list *bl); + void (*mobname_additional_ack) (int fd, struct block_list *bl); + void (*mobname_normal_ack) (int fd, struct block_list *bl); + void (*chatname_ack) (int fd, struct block_list *bl); + void (*elemname_ack) (int fd, struct block_list *bl); + void (*unknownname_ack) (int fd, struct block_list *bl); void (*monster_hp_bar) ( struct mob_data* md, struct map_session_data *sd ); int (*hpmeter) (struct map_session_data *sd); void (*hpmeter_single) (int fd, int id, unsigned int hp, unsigned int maxhp); @@ -986,6 +999,7 @@ struct clif_interface { void (*joinchatok) (struct map_session_data *sd,struct chat_data* cd); void (*addchat) (struct chat_data* cd,struct map_session_data *sd); void (*changechatowner) (struct chat_data* cd, struct map_session_data* sd); + void (*chatRoleChange) (struct chat_data *cd, struct map_session_data *sd, struct block_list* bl, int isNotOwner); void (*clearchat) (struct chat_data *cd,int fd); void (*leavechat) (struct chat_data* cd, struct map_session_data* sd, bool flag); void (*changechatstatus) (struct chat_data* cd); @@ -1249,11 +1263,13 @@ struct clif_interface { /* */ bool (*parse_roulette_db) (void); void (*roulette_generate_ack) (struct map_session_data *sd, enum GENERATE_ROULETTE_ACK result, short stage, short prizeIdx, int bonusItemID); + void (*roulette_close) (struct map_session_data *sd); /* Merge Items */ void (*openmergeitem) (int fd, struct map_session_data *sd); void (*cancelmergeitem) (int fd, struct map_session_data *sd); int (*comparemergeitem) (const void *a, const void *b); void (*ackmergeitems) (int fd, struct map_session_data *sd); + void (*mergeitems) (int fd, struct map_session_data *sd, int index, int amount, enum mergeitem_reason reason); /* */ bool (*isdisguised) (struct block_list* bl); void (*navigate_to) (struct map_session_data *sd, const char* mapname, uint16 x, uint16 y, uint8 flag, bool hideWindow, uint16 mob_id); @@ -1483,6 +1499,7 @@ struct clif_interface { void (*pCashShopBuy) (int fd, struct map_session_data *sd); void (*pPartyTick) (int fd, struct map_session_data *sd); void (*pGuildInvite2) (int fd, struct map_session_data *sd); + void (*cashShopBuyAck) (int fd, struct map_session_data *sd, int itemId, enum CASH_SHOP_BUY_RESULT result); /* Group Search System Update */ void (*pPartyBookingAddFilter) (int fd, struct map_session_data *sd); void (*pPartyBookingSubFilter) (int fd, struct map_session_data *sd); @@ -1592,6 +1609,8 @@ struct clif_interface { int (*pingTimer) (int tid, int64 tick, int id, intptr_t data); int (*pingTimerSub) (struct map_session_data *sd, va_list ap); void (*pResetCooldown) (int fd, struct map_session_data *sd); + void (*loadConfirm) (struct map_session_data *sd); + void (*send_selforarea) (int fd, struct block_list *bl, const void *buf, int len); }; #ifdef HERCULES_CORE diff --git a/src/map/mail.c b/src/map/mail.c index 0a4b91e34..0a6603a45 100644 --- a/src/map/mail.c +++ b/src/map/mail.c @@ -177,7 +177,7 @@ static int mail_openmail(struct map_session_data *sd) { nullpo_ret(sd); - if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->state.vending || sd->state.buyingstore || sd->state.trading) + if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->state.vending || sd->state.prevend || sd->state.buyingstore || sd->state.trading) return 0; clif->mail_window(sd->fd, 0); diff --git a/src/map/messages_main.h b/src/map/messages_main.h index 52c953ac8..802621eb2 100644 --- a/src/map/messages_main.h +++ b/src/map/messages_main.h @@ -24,7 +24,7 @@ /* This file is autogenerated, please do not commit manual changes -Latest version: 20190403 +Latest version: 20190418 */ enum clif_messages { @@ -21589,6 +21589,32 @@ Please try again in a moment. */ MSG_ID_E13 = 0xe13, #endif +#if PACKETVER >= 20190417 +/*20190417 to latest +리딩 스펠북으로 저장된 마법이 없습니다. +*/ + MSG_ID_E14 = 0xe14, +/*20190417 to latest +이동 시 사용한 아이템은 재교환이 불가능합니다. +*/ + MSG_ID_E15 = 0xe15, +/*20190417 to latest +자유이동권을 구매 하였습니다 +*/ + MSG_ID_E16 = 0xe16, +/*20190417 to latest +자유이동권 사용 중, 관련 아이템을 소모하지 않습니다. +*/ + MSG_ID_E17 = 0xe17, +/*20190417 to latest +적용 +*/ + MSG_ID_E18 = 0xe18, +/*20190417 to latest +중지 +*/ + MSG_ID_E19 = 0xe19, +#endif }; #endif /* MAP_MESSAGES_MAIN_H */ diff --git a/src/map/messages_re.h b/src/map/messages_re.h index 3823720ad..b81476f9c 100644 --- a/src/map/messages_re.h +++ b/src/map/messages_re.h @@ -24,7 +24,7 @@ /* This file is autogenerated, please do not commit manual changes -Latest version: 20190403 +Latest version: 20190418 */ enum clif_messages { @@ -21068,6 +21068,32 @@ Please try again in a moment. */ MSG_ID_E13 = 0xe13, #endif +#if PACKETVER >= 20190417 +/*20190417 to latest +리딩 스펠북으로 저장된 마법이 없습니다. +*/ + MSG_ID_E14 = 0xe14, +/*20190417 to latest +이동 시 사용한 아이템은 재교환이 불가능합니다. +*/ + MSG_ID_E15 = 0xe15, +/*20190417 to latest +자유이동권을 구매 하였습니다 +*/ + MSG_ID_E16 = 0xe16, +/*20190417 to latest +자유이동권 사용 중, 관련 아이템을 소모하지 않습니다. +*/ + MSG_ID_E17 = 0xe17, +/*20190417 to latest +적용 +*/ + MSG_ID_E18 = 0xe18, +/*20190417 to latest +중지 +*/ + MSG_ID_E19 = 0xe19, +#endif }; #endif /* MAP_MESSAGES_RE_H */ diff --git a/src/map/messages_zero.h b/src/map/messages_zero.h index 90c7e8895..ab48ae4ab 100644 --- a/src/map/messages_zero.h +++ b/src/map/messages_zero.h @@ -24,7 +24,7 @@ /* This file is autogenerated, please do not commit manual changes -Latest version: 20190403 +Latest version: 20190502 */ enum clif_messages { @@ -17674,6 +17674,116 @@ Please try again in a moment. */ MSG_ID_E13 = 0xe13, #endif +#if PACKETVER >= 20190424 +/*20190424 to latest +리딩 스펠북으로 저장된 마법이 없습니다. +*/ + MSG_ID_E14 = 0xe14, +/*20190424 to latest +이동 시 사용한 아이템은 재교환이 불가능합니다. +*/ + MSG_ID_E15 = 0xe15, +/*20190424 to latest +자유이동권을 구매 하였습니다 +*/ + MSG_ID_E16 = 0xe16, +/*20190424 to latest +자유이동권 사용 중, 관련 아이템을 소모하지 않습니다. +*/ + MSG_ID_E17 = 0xe17, +/*20190424 to latest +적용 +*/ + MSG_ID_E18 = 0xe18, +/*20190424 to latest +중지 +*/ + MSG_ID_E19 = 0xe19, +/*20190424 to latest +자유이동권 +*/ + MSG_ID_E1A = 0xe1a, +/*20190424 to latest +%d시간 이용, %s %d개 +*/ + MSG_ID_E1B = 0xe1b, +/*20190424 to latest +자유이용권 사용중 +*/ + MSG_ID_E1C = 0xe1c, +/*20190424 to latest +특성 스테이터스 +*/ + MSG_ID_E1D = 0xe1d, +/*20190424 to latest +파워 파라메터 +^cc0000물리 공격력, 특성 공격력^ffffff 증가 +*/ + MSG_ID_E1E = 0xe1e, +/*20190424 to latest +스테미나 파라메터 +^cc0000물리 저항력^ffffff 증가 +*/ + MSG_ID_E1F = 0xe1f, +/*20190424 to latest +위즈덤 파라메터 +^cc0000마법 저항력^ffffff 증가 +*/ + MSG_ID_E20 = 0xe20, +/*20190424 to latest +스펠 파라메터 +^cc0000마법 공격력, 마법 공격력^ffffff 증가 +*/ + MSG_ID_E21 = 0xe21, +/*20190424 to latest +컨센트레이션 파라메터 +^cc0000명중률, 회피율, 특성 물리/마법 공격력^ffffff 증가 +*/ + MSG_ID_E22 = 0xe22, +/*20190424 to latest +크리에이티브 파라메터 +^cc0000특성 힐 회복량, 크리티컬 데미지 비율^ffffff 증가 +*/ + MSG_ID_E23 = 0xe23, +/*20190424 to latest +특성 물리 공격력 +*/ + MSG_ID_E24 = 0xe24, +/*20190424 to latest +특성 마법 공격력 +*/ + MSG_ID_E25 = 0xe25, +/*20190424 to latest +물리 저항력 +*/ + MSG_ID_E26 = 0xe26, +/*20190424 to latest +마법 저항력 +*/ + MSG_ID_E27 = 0xe27, +/*20190424 to latest +특성 힐 회복량 +*/ + MSG_ID_E28 = 0xe28, +/*20190424 to latest +크리티컬 데미지 비율 +*/ + MSG_ID_E29 = 0xe29, +/*20190424 to latest +특성 파라메터 레벨업에 사용되는 포인트 +*/ + MSG_ID_E2A = 0xe2a, +#endif +#if PACKETVER >= 20190502 +/*20190502 to latest +J.Lv +*/ + MSG_ID_E2B = 0xe2b, +/*20190502 to latest +AP +*/ + MSG_ID_E2C = 0xe2c, +#endif }; #endif /* MAP_MESSAGES_ZERO_H */ diff --git a/src/map/packets.h b/src/map/packets.h index a0b6b7f4b..99404cbe3 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -1938,7 +1938,7 @@ packet(0x96e,clif->ackmergeitems); packet(0x0b12,clif->pNPCBarterClosed); #endif -#if PACKETVER_MAIN_NUM >= 20190403 || PACKETVER_RE_NUM >= 20190320 +#if PACKETVER_MAIN_NUM >= 20190227 || PACKETVER_RE_NUM >= 20190220 || PACKETVER_ZERO_NUM >= 20190220 packet(0x0b1c,clif->pPing); #endif diff --git a/src/map/packets_keys_main.h b/src/map/packets_keys_main.h index 9505fb454..8a6f32a54 100644 --- a/src/map/packets_keys_main.h +++ b/src/map/packets_keys_main.h @@ -37,7 +37,7 @@ packetKeys(0x49357d72,0x22c370a1,0x5f836591); #endif -// 2010-11-23aRagexeRE, 2010-11-24aRagexeRE, 2010-11-24bRagexeRE, 2010-11-25aRagexeRE, 2010-11-26aRagexeRE, 2010-11-30aRagexeRE, 2010-12-07aRagexeRE, 2010-12-14aRagexeRE, 2010-12-21aRagexeRE, 2010-12-23aRagexeRE, 2010-12-28aRagexeRE, 2011-01-04aRagexeRE, 2011-01-05aRagexeRE, 2011-01-11aRagexeRE, 2011-01-18aRagexeRE, 2011-01-25aRagexeRE, 2011-01-26aRagexeRE, 2011-01-26bRagexeRE, 2011-01-31aRagexeRE, 2011-01-31bRagexeRE, 2011-01-31cRagexeRE, 2011-02-08aRagexeRE, 2011-02-15aRagexeRE, 2011-02-22aRagexeRE, 2011-02-23aRagexeRE, 2011-02-23bRagexeRE, 2011-02-24aRagexeRE, 2011-02-25aRagexeRE, 2011-02-28aRagexeRE, 2011-03-08aRagexeRE, 2011-03-09aRagexeRE, 2011-03-09bRagexeRE, 2011-03-09cRagexeRE, 2011-03-09dRagexeRE, 2011-03-15aRagexeRE, 2011-03-22aRagexeRE, 2011-03-29aRagexeRE, 2011-03-30aRagexeRE, 2011-03-30cRagexeRE, 2011-04-05aRagexeRE, 2011-04-12aRagexeRE, 2011-04-19aRagexeRE, 2011-04-20aRagexeRE, 2011-04-26aRagexeRE, 2011-04-27aRagexeRE, 2011-05-03aRagexeRE, 2011-05-11aRagexeRE, 2011-05-17bRagexeRE, 2011-05-24aRagexeRE, 2011-05-26aRagexeRE, 2011-05-31aRagexeRE, 2011-06-07aRagexeRE, 2011-06-08aRagexeRE, 2011-06-08bRagexeRE, 2011-06-08cRagexeRE, 2011-06-09aRagexeRE, 2011-06-14bRagexeRE, 2011-06-22aRagexeRE, 2011-06-28aRagexeRE, 2011-07-06aRagexeRE, 2011-07-13aRagexeRE, 2011-07-13bRagexeRE, 2011-07-13cRagexeRE, 2011-07-19aRagexeRE, 2011-07-26aRagexeRE, 2011-08-03aRagexeRE, 2011-08-03bRagexeRE, 2011-08-10aRagexeRE, 2013-12-23aRagexeRE, 2014-05-08aRagexe, 2014-05-08aRagexeRE, 2014-06-11eRagexe, 2015-02-25hRagexe, 2018-03-15aRagexe, 2018-03-21aRagexe, 2018-03-21aRagexeRE, 2018-03-28bRagexe, 2018-03-28bRagexeRE, 2018-04-04bRagexe, 2018-04-04cRagexeRE, 2018-04-18aRagexe, 2018-04-18bRagexeRE, 2018-04-25cRagexe, 2018-04-25cRagexeRE, 2018-05-02bRagexe, 2018-05-02bRagexeRE, 2018-05-02dRagexeRE, 2018-05-09aRagexe, 2018-05-16cRagexe, 2018-05-16cRagexeRE, 2018-05-23aRagexe, 2018-05-23aRagexeRE, 2018-05-30aRagexe, 2018-05-30bRagexeRE, 2018-05-30cRagexeRE, 2018-06-05bRagexe, 2018-06-05bRagexeRE, 2018-06-12aRagexeRE, 2018-06-12bRagexeRE, 2018-06-20cRagexe, 2018-06-20dRagexeRE, 2018-06-20eRagexe, 2018-06-20eRagexeRE, 2018-06-21aRagexe, 2018-06-21aRagexeRE, 2018-07-04aRagexe, 2018-07-04aRagexeRE, 2018-07-11aRagexeRE, 2018-07-18bRagexe, 2018-07-18bRagexeRE, 2018-07-18bRagexeRE1, 2018-07-18cRagexe, 2018-07-18cRagexeRE, 2018-08-01cRagexe, 2018-08-01cRagexeRE, 2018-08-08bRagexe, 2018-08-08bRagexeRE, 2018-08-22cRagexe, 2018-08-22cRagexeRE, 2018-08-29aRagexe, 2018-08-29aRagexeRE, 2018-08-29bRagexeRE, 2018-08-31aRagexe, 2018-09-12dRagexe, 2018-09-12dRagexeRE, 2018-09-19aRagexe, 2018-09-19aRagexeRE, 2018-10-02aRagexe, 2018-10-02aRagexeRE, 2018-10-02bRagexe, 2018-10-02bRagexeRE, 2018-10-17_02aRagexe, 2018-10-17_02aRagexeRE, 2018-10-17_03aRagexe, 2018-10-17_03aRagexeRE, 2018-10-17bRagexe, 2018-10-17bRagexeRE, 2018-10-24bRagexe, 2018-10-31aRagexe, 2018-10-31bRagexe, 2018-10-31cRagexeRE, 2018-11-07aRagexe, 2018-11-07aRagexeRE, 2018-11-14cRagexe, 2018-11-14cRagexeRE, 2018-11-14dRagexe, 2018-11-14dRagexeRE, 2018-11-21bRagexe, 2018-11-21cRagexeRE, 2018-11-28aRagexe, 2018-11-28aRagexeRE, 2018-11-28bRagexe, 2018-11-28cRagexe, 2018-12-05aRagexe, 2018-12-05bRagexeRE, 2018-12-12aRagexe, 2018-12-12aRagexeRE, 2018-12-12bRagexe, 2018-12-12bRagexeRE, 2018-12-19bRagexe, 2018-12-19bRagexeRE, 2018-12-26aRagexe, 2018-12-26aRagexeRE, 2019-01-09aRagexe, 2019-01-09bRagexeRE, 2019-01-16bRagexe, 2019-01-16bRagexeRE, 2019-01-16cRagexe, 2019-01-16cRagexeRE, 2019-01-23dRagexe, 2019-01-23dRagexeRE, 2019-02-13IRagexeRE, 2019-02-13bRagexe, 2019-02-13eRagexe, 2019-02-20aRagexeRE, 2019-02-27aRagexe, 2019-02-27bRagexeRE, 2019-02-28aRagexe, 2019-02-28aRagexeRE, 2019-03-06bRagexe, 2019-03-06bRagexeRE, 2019-03-06cRagexe, 2019-03-06cRagexeRE, 2019-03-13aRagexe, 2019-03-20aRagexe, 2019-03-20aRagexeRE, 2019-03-22aRagexe, 2019-03-22aRagexeRE, 2019-03-27bRagexe, 2019-03-27bRagexeRE, 2019-04-03aRagexe, 2019-04-03bRagexeRE, 2019-04-03cRagexeRE +// 2010-11-23aRagexeRE, 2010-11-24aRagexeRE, 2010-11-24bRagexeRE, 2010-11-25aRagexeRE, 2010-11-26aRagexeRE, 2010-11-30aRagexeRE, 2010-12-07aRagexeRE, 2010-12-14aRagexeRE, 2010-12-21aRagexeRE, 2010-12-23aRagexeRE, 2010-12-28aRagexeRE, 2011-01-04aRagexeRE, 2011-01-05aRagexeRE, 2011-01-11aRagexeRE, 2011-01-18aRagexeRE, 2011-01-25aRagexeRE, 2011-01-26aRagexeRE, 2011-01-26bRagexeRE, 2011-01-31aRagexeRE, 2011-01-31bRagexeRE, 2011-01-31cRagexeRE, 2011-02-08aRagexeRE, 2011-02-15aRagexeRE, 2011-02-22aRagexeRE, 2011-02-23aRagexeRE, 2011-02-23bRagexeRE, 2011-02-24aRagexeRE, 2011-02-25aRagexeRE, 2011-02-28aRagexeRE, 2011-03-08aRagexeRE, 2011-03-09aRagexeRE, 2011-03-09bRagexeRE, 2011-03-09cRagexeRE, 2011-03-09dRagexeRE, 2011-03-15aRagexeRE, 2011-03-22aRagexeRE, 2011-03-29aRagexeRE, 2011-03-30aRagexeRE, 2011-03-30cRagexeRE, 2011-04-05aRagexeRE, 2011-04-12aRagexeRE, 2011-04-19aRagexeRE, 2011-04-20aRagexeRE, 2011-04-26aRagexeRE, 2011-04-27aRagexeRE, 2011-05-03aRagexeRE, 2011-05-11aRagexeRE, 2011-05-17bRagexeRE, 2011-05-24aRagexeRE, 2011-05-26aRagexeRE, 2011-05-31aRagexeRE, 2011-06-07aRagexeRE, 2011-06-08aRagexeRE, 2011-06-08bRagexeRE, 2011-06-08cRagexeRE, 2011-06-09aRagexeRE, 2011-06-14bRagexeRE, 2011-06-22aRagexeRE, 2011-06-28aRagexeRE, 2011-07-06aRagexeRE, 2011-07-13aRagexeRE, 2011-07-13bRagexeRE, 2011-07-13cRagexeRE, 2011-07-19aRagexeRE, 2011-07-26aRagexeRE, 2011-08-03aRagexeRE, 2011-08-03bRagexeRE, 2011-08-10aRagexeRE, 2013-12-23aRagexeRE, 2014-05-08aRagexe, 2014-05-08aRagexeRE, 2014-06-11eRagexe, 2015-02-25hRagexe, 2018-03-15aRagexe, 2018-03-21aRagexe, 2018-03-21aRagexeRE, 2018-03-28bRagexe, 2018-03-28bRagexeRE, 2018-04-04bRagexe, 2018-04-04cRagexeRE, 2018-04-18aRagexe, 2018-04-18bRagexeRE, 2018-04-25cRagexe, 2018-04-25cRagexeRE, 2018-05-02bRagexe, 2018-05-02bRagexeRE, 2018-05-02dRagexeRE, 2018-05-09aRagexe, 2018-05-16cRagexe, 2018-05-16cRagexeRE, 2018-05-23aRagexe, 2018-05-23aRagexeRE, 2018-05-30aRagexe, 2018-05-30bRagexeRE, 2018-05-30cRagexeRE, 2018-06-05bRagexe, 2018-06-05bRagexeRE, 2018-06-12aRagexeRE, 2018-06-12bRagexeRE, 2018-06-20cRagexe, 2018-06-20dRagexeRE, 2018-06-20eRagexe, 2018-06-20eRagexeRE, 2018-06-21aRagexe, 2018-06-21aRagexeRE, 2018-07-04aRagexe, 2018-07-04aRagexeRE, 2018-07-11aRagexeRE, 2018-07-18bRagexe, 2018-07-18bRagexeRE, 2018-07-18bRagexeRE1, 2018-07-18cRagexe, 2018-07-18cRagexeRE, 2018-08-01cRagexe, 2018-08-01cRagexeRE, 2018-08-08bRagexe, 2018-08-08bRagexeRE, 2018-08-22cRagexe, 2018-08-22cRagexeRE, 2018-08-29aRagexe, 2018-08-29aRagexeRE, 2018-08-29bRagexeRE, 2018-08-31aRagexe, 2018-09-12dRagexe, 2018-09-12dRagexeRE, 2018-09-19aRagexe, 2018-09-19aRagexeRE, 2018-10-02aRagexe, 2018-10-02aRagexeRE, 2018-10-02bRagexe, 2018-10-02bRagexeRE, 2018-10-17_02aRagexe, 2018-10-17_02aRagexeRE, 2018-10-17_03aRagexe, 2018-10-17_03aRagexeRE, 2018-10-17bRagexe, 2018-10-17bRagexeRE, 2018-10-24bRagexe, 2018-10-31aRagexe, 2018-10-31bRagexe, 2018-10-31cRagexeRE, 2018-11-07aRagexe, 2018-11-07aRagexeRE, 2018-11-14cRagexe, 2018-11-14cRagexeRE, 2018-11-14dRagexe, 2018-11-14dRagexeRE, 2018-11-21bRagexe, 2018-11-21cRagexeRE, 2018-11-28aRagexe, 2018-11-28aRagexeRE, 2018-11-28bRagexe, 2018-11-28cRagexe, 2018-12-05aRagexe, 2018-12-05bRagexeRE, 2018-12-12aRagexe, 2018-12-12aRagexeRE, 2018-12-12bRagexe, 2018-12-12bRagexeRE, 2018-12-19bRagexe, 2018-12-19bRagexeRE, 2018-12-26aRagexe, 2018-12-26aRagexeRE, 2019-01-09aRagexe, 2019-01-09bRagexeRE, 2019-01-16bRagexe, 2019-01-16bRagexeRE, 2019-01-16cRagexe, 2019-01-16cRagexeRE, 2019-01-23dRagexe, 2019-01-23dRagexeRE, 2019-02-13IRagexeRE, 2019-02-13bRagexe, 2019-02-13eRagexe, 2019-02-20aRagexeRE, 2019-02-27aRagexe, 2019-02-27bRagexeRE, 2019-02-28aRagexe, 2019-02-28aRagexeRE, 2019-03-06bRagexe, 2019-03-06bRagexeRE, 2019-03-06cRagexe, 2019-03-06cRagexeRE, 2019-03-13aRagexe, 2019-03-20aRagexe, 2019-03-20aRagexeRE, 2019-03-22aRagexe, 2019-03-22aRagexeRE, 2019-03-27bRagexe, 2019-03-27bRagexeRE, 2019-04-03aRagexe, 2019-04-03bRagexeRE, 2019-04-03cRagexeRE, 2019-04-17aRagexe, 2019-04-17cRagexeRE, 2019-04-18aRagexe, 2019-04-18aRagexeRE #if PACKETVER == 20101123 || \ PACKETVER == 20101124 || \ PACKETVER == 20101125 || \ @@ -145,7 +145,9 @@ PACKETVER == 20190320 || \ PACKETVER == 20190322 || \ PACKETVER == 20190327 || \ - PACKETVER >= 20190403 + PACKETVER == 20190403 || \ + PACKETVER == 20190417 || \ + PACKETVER >= 20190418 packetKeys(0x00000000,0x00000000,0x00000000); #endif diff --git a/src/map/packets_keys_zero.h b/src/map/packets_keys_zero.h index e36091424..5a9e65f14 100644 --- a/src/map/packets_keys_zero.h +++ b/src/map/packets_keys_zero.h @@ -30,7 +30,7 @@ /* This file is autogenerated, please do not commit manual changes */ -// 2017-10-18aRagexe_zero, 2017-10-19aRagexe_zero, 2017-10-23aRagexe_zero, 2017-10-23bRagexe_zero, 2017-10-23cRagexe_zero, 2017-10-24aRagexe_2_zero, 2017-10-24aRagexe_zero, 2017-10-25bRagexe_zero, 2017-10-27aRagexe_zero, 2017-10-27bRagexe_zero, 2017-10-30aRagexe_zero, 2017-10-31aRagexe_zero, 2017-11-09aRagexe_zero, 2017-11-13aRagexe_zero, 2017-11-13bRagexe_zero, 2018-03-15aRagexe_zero, 2018-03-21aRagexe_zero, 2018-03-21bRagexe_zero, 2018-03-28_1aRagexe_zero, 2018-03-28cRagexe_zero, 2018-04-11aRagexe_zero, 2018-04-25_3aRagexe_zero, 2018-05-09_3aRagexe_zero, 2018-05-23aRagexe_zero, 2018-06-05bRagexe_zero, 2018-06-05cRagexe_zero, 2018-06-27aRagexe_zero, 2018-07-03aRagexe_zero, 2018-07-11_2aRagexe_zero, 2018-07-25_2aRagexe_zero, 2018-08-01aRagexe_zero, 2018-08-08_2aRagexe_zero, 2018-08-22aRagexe_zero, 2018-08-29aRagexe_zero, 2018-09-05aRagexe_zero, 2018-09-12aRagexe_zero, 2018-09-19aRagexe_zero, 2018-09-28aRagexe_zero, 2018-10-10_2aRagexe_zero, 2018-10-24_2aRagexe_zero, 2018-11-14aRagexe_zero, 2018-11-20aRagexe_zero, 2018-11-28aRagexe_zero, 2018-12-12aRagexe_zero, 2018-12-19aRagexe_zero, 2018-12-26_2aRagexe_zero, 2019-01-16_2aRagexe_zero, 2019-01-17_1aRagexe_zero, 2019-01-30_2aRagexe_zero, 2019-02-13aRagexe_zero, 2019-02-20aRagexe_zero, 2019-02-27aRagexe_zero, 2019-03-13aRagexe_zero, 2019-03-27_2aRagexe_zero, 2019-03-27_3aRagexe_zero, 2019-04-03aRagexe_zero +// 2017-10-18aRagexe_zero, 2017-10-19aRagexe_zero, 2017-10-23aRagexe_zero, 2017-10-23bRagexe_zero, 2017-10-23cRagexe_zero, 2017-10-24aRagexe_2_zero, 2017-10-24aRagexe_zero, 2017-10-25bRagexe_zero, 2017-10-27aRagexe_zero, 2017-10-27bRagexe_zero, 2017-10-30aRagexe_zero, 2017-10-31aRagexe_zero, 2017-11-09aRagexe_zero, 2017-11-13aRagexe_zero, 2017-11-13bRagexe_zero, 2018-03-15aRagexe_zero, 2018-03-21aRagexe_zero, 2018-03-21bRagexe_zero, 2018-03-28_1aRagexe_zero, 2018-03-28cRagexe_zero, 2018-04-11aRagexe_zero, 2018-04-25_3aRagexe_zero, 2018-05-09_3aRagexe_zero, 2018-05-23aRagexe_zero, 2018-06-05bRagexe_zero, 2018-06-05cRagexe_zero, 2018-06-27aRagexe_zero, 2018-07-03aRagexe_zero, 2018-07-11_2aRagexe_zero, 2018-07-25_2aRagexe_zero, 2018-08-01aRagexe_zero, 2018-08-08_2aRagexe_zero, 2018-08-22aRagexe_zero, 2018-08-29aRagexe_zero, 2018-09-05aRagexe_zero, 2018-09-12aRagexe_zero, 2018-09-19aRagexe_zero, 2018-09-28aRagexe_zero, 2018-10-10_2aRagexe_zero, 2018-10-24_2aRagexe_zero, 2018-11-14aRagexe_zero, 2018-11-20aRagexe_zero, 2018-11-28aRagexe_zero, 2018-12-12aRagexe_zero, 2018-12-19aRagexe_zero, 2018-12-26_2aRagexe_zero, 2019-01-16_2aRagexe_zero, 2019-01-17_1aRagexe_zero, 2019-01-30_2aRagexe_zero, 2019-02-13aRagexe_zero, 2019-02-20aRagexe_zero, 2019-02-27aRagexe_zero, 2019-03-13aRagexe_zero, 2019-03-27_2aRagexe_zero, 2019-03-27_3aRagexe_zero, 2019-04-03aRagexe_zero, 2019-04-10bRagexe_zero, 2019-04-24aRagexe_zero, 2019-05-02aRagexe_zero #if PACKETVER == 20171018 || \ PACKETVER == 20171019 || \ PACKETVER == 20171023 || \ @@ -77,7 +77,10 @@ PACKETVER == 20190227 || \ PACKETVER == 20190313 || \ PACKETVER == 20190327 || \ - PACKETVER >= 20190403 + PACKETVER == 20190403 || \ + PACKETVER == 20190410 || \ + PACKETVER == 20190424 || \ + PACKETVER >= 20190502 packetKeys(0x00000000,0x00000000,0x00000000); #endif diff --git a/src/map/packets_shuffle_main.h b/src/map/packets_shuffle_main.h index d0c3099b9..a5ce83ebe 100644 --- a/src/map/packets_shuffle_main.h +++ b/src/map/packets_shuffle_main.h @@ -9727,7 +9727,7 @@ packet(0x0967,clif->pSolveCharName,2); // CZ_REQNAME_BYGID // 6 #endif -// 2018-11-21bRagexe, 2018-11-28aRagexe, 2018-11-28bRagexe, 2018-11-28cRagexe, 2018-12-05aRagexe, 2018-12-12aRagexe, 2018-12-12bRagexe, 2018-12-19bRagexe, 2018-12-26aRagexe, 2019-01-09aRagexe, 2019-01-16bRagexe, 2019-01-16cRagexe, 2019-01-23dRagexe, 2019-02-13bRagexe, 2019-02-13eRagexe, 2019-02-27aRagexe, 2019-02-28aRagexe, 2019-03-06bRagexe, 2019-03-06cRagexe, 2019-03-13aRagexe, 2019-03-20aRagexe, 2019-03-22aRagexe, 2019-03-27bRagexe, 2019-04-03aRagexe +// 2018-11-21bRagexe, 2018-11-28aRagexe, 2018-11-28bRagexe, 2018-11-28cRagexe, 2018-12-05aRagexe, 2018-12-12aRagexe, 2018-12-12bRagexe, 2018-12-19bRagexe, 2018-12-26aRagexe, 2019-01-09aRagexe, 2019-01-16bRagexe, 2019-01-16cRagexe, 2019-01-23dRagexe, 2019-02-13bRagexe, 2019-02-13eRagexe, 2019-02-27aRagexe, 2019-02-28aRagexe, 2019-03-06bRagexe, 2019-03-06cRagexe, 2019-03-13aRagexe, 2019-03-20aRagexe, 2019-03-22aRagexe, 2019-03-27bRagexe, 2019-04-03aRagexe, 2019-04-17aRagexe, 2019-04-18aRagexe #if PACKETVER == 20181121 || \ PACKETVER == 20181128 || \ PACKETVER == 20181205 || \ @@ -9745,7 +9745,9 @@ PACKETVER == 20190320 || \ PACKETVER == 20190322 || \ PACKETVER == 20190327 || \ - PACKETVER >= 20190403 + PACKETVER == 20190403 || \ + PACKETVER == 20190417 || \ + PACKETVER >= 20190418 packet(0x0202,clif->pFriendsListAdd,2); // CZ_ADD_FRIENDS // 26 packet(0x022d,clif->pHomMenu,2,4); // CZ_COMMAND_MER // 5 packet(0x023b,clif->pStoragePassword,0); // CZ_ACK_STORE_PASSWORD // 36 diff --git a/src/map/packets_shuffle_re.h b/src/map/packets_shuffle_re.h index c41095fb4..5808e4c17 100644 --- a/src/map/packets_shuffle_re.h +++ b/src/map/packets_shuffle_re.h @@ -9663,7 +9663,7 @@ packet(0x083c,clif->pSearchStoreInfoListItemClick,2,6,10); // CZ_SSILIST_ITEM_CLICK // 12 #endif -// 2018-07-04aRagexeRE, 2018-07-11aRagexeRE, 2018-07-18bRagexeRE, 2018-07-18bRagexeRE1, 2018-07-18cRagexeRE, 2018-08-01cRagexeRE, 2018-08-08bRagexeRE, 2018-08-22cRagexeRE, 2018-08-29aRagexeRE, 2018-08-29bRagexeRE, 2018-09-12dRagexeRE, 2018-09-19aRagexeRE, 2018-10-02aRagexeRE, 2018-10-02bRagexeRE, 2018-10-17_02aRagexeRE, 2018-10-17_03aRagexeRE, 2018-10-17bRagexeRE, 2018-10-31cRagexeRE, 2018-11-07aRagexeRE, 2018-11-14cRagexeRE, 2018-11-14dRagexeRE, 2018-11-21cRagexeRE, 2018-11-28aRagexeRE, 2018-12-05bRagexeRE, 2018-12-12aRagexeRE, 2018-12-12bRagexeRE, 2018-12-19bRagexeRE, 2018-12-26aRagexeRE, 2019-01-09bRagexeRE, 2019-01-16bRagexeRE, 2019-01-16cRagexeRE, 2019-01-23dRagexeRE, 2019-02-13IRagexeRE, 2019-02-20aRagexeRE, 2019-02-27bRagexeRE, 2019-02-28aRagexeRE, 2019-03-06bRagexeRE, 2019-03-06cRagexeRE, 2019-03-20aRagexeRE, 2019-03-22aRagexeRE, 2019-03-27bRagexeRE, 2019-04-03bRagexeRE, 2019-04-03cRagexeRE +// 2018-07-04aRagexeRE, 2018-07-11aRagexeRE, 2018-07-18bRagexeRE, 2018-07-18bRagexeRE1, 2018-07-18cRagexeRE, 2018-08-01cRagexeRE, 2018-08-08bRagexeRE, 2018-08-22cRagexeRE, 2018-08-29aRagexeRE, 2018-08-29bRagexeRE, 2018-09-12dRagexeRE, 2018-09-19aRagexeRE, 2018-10-02aRagexeRE, 2018-10-02bRagexeRE, 2018-10-17_02aRagexeRE, 2018-10-17_03aRagexeRE, 2018-10-17bRagexeRE, 2018-10-31cRagexeRE, 2018-11-07aRagexeRE, 2018-11-14cRagexeRE, 2018-11-14dRagexeRE, 2018-11-21cRagexeRE, 2018-11-28aRagexeRE, 2018-12-05bRagexeRE, 2018-12-12aRagexeRE, 2018-12-12bRagexeRE, 2018-12-19bRagexeRE, 2018-12-26aRagexeRE, 2019-01-09bRagexeRE, 2019-01-16bRagexeRE, 2019-01-16cRagexeRE, 2019-01-23dRagexeRE, 2019-02-13IRagexeRE, 2019-02-20aRagexeRE, 2019-02-27bRagexeRE, 2019-02-28aRagexeRE, 2019-03-06bRagexeRE, 2019-03-06cRagexeRE, 2019-03-20aRagexeRE, 2019-03-22aRagexeRE, 2019-03-27bRagexeRE, 2019-04-03bRagexeRE, 2019-04-03cRagexeRE, 2019-04-17cRagexeRE, 2019-04-18aRagexeRE #if PACKETVER == 20180704 || \ PACKETVER == 20180711 || \ PACKETVER == 20180718 || \ @@ -9695,7 +9695,9 @@ PACKETVER == 20190320 || \ PACKETVER == 20190322 || \ PACKETVER == 20190327 || \ - PACKETVER >= 20190403 + PACKETVER == 20190403 || \ + PACKETVER == 20190417 || \ + PACKETVER >= 20190418 packet(0x0202,clif->pFriendsListAdd,2); // CZ_ADD_FRIENDS // 26 packet(0x022d,clif->pHomMenu,2,4); // CZ_COMMAND_MER // 5 packet(0x023b,clif->pStoragePassword,0); // CZ_ACK_STORE_PASSWORD // 36 diff --git a/src/map/packets_shuffle_zero.h b/src/map/packets_shuffle_zero.h index ccf11a647..7fd34a51b 100644 --- a/src/map/packets_shuffle_zero.h +++ b/src/map/packets_shuffle_zero.h @@ -742,7 +742,7 @@ packet(0x0968,clif->pStoragePassword,0); // CZ_ACK_STORE_PASSWORD // 36 #endif -// 2018-11-14aRagexe_zero, 2018-11-20aRagexe_zero, 2018-11-28aRagexe_zero, 2018-12-12aRagexe_zero, 2018-12-19aRagexe_zero, 2018-12-26_2aRagexe_zero, 2019-01-16_2aRagexe_zero, 2019-01-17_1aRagexe_zero, 2019-01-30_2aRagexe_zero, 2019-02-13aRagexe_zero, 2019-02-20aRagexe_zero, 2019-02-27aRagexe_zero, 2019-03-13aRagexe_zero, 2019-03-27_2aRagexe_zero, 2019-03-27_3aRagexe_zero, 2019-04-03aRagexe_zero +// 2018-11-14aRagexe_zero, 2018-11-20aRagexe_zero, 2018-11-28aRagexe_zero, 2018-12-12aRagexe_zero, 2018-12-19aRagexe_zero, 2018-12-26_2aRagexe_zero, 2019-01-16_2aRagexe_zero, 2019-01-17_1aRagexe_zero, 2019-01-30_2aRagexe_zero, 2019-02-13aRagexe_zero, 2019-02-20aRagexe_zero, 2019-02-27aRagexe_zero, 2019-03-13aRagexe_zero, 2019-03-27_2aRagexe_zero, 2019-03-27_3aRagexe_zero, 2019-04-03aRagexe_zero, 2019-04-10bRagexe_zero, 2019-04-24aRagexe_zero, 2019-05-02aRagexe_zero #if PACKETVER == 20181114 || \ PACKETVER == 20181120 || \ PACKETVER == 20181128 || \ @@ -757,7 +757,10 @@ PACKETVER == 20190227 || \ PACKETVER == 20190313 || \ PACKETVER == 20190327 || \ - PACKETVER >= 20190403 + PACKETVER == 20190403 || \ + PACKETVER == 20190410 || \ + PACKETVER == 20190424 || \ + PACKETVER >= 20190502 packet(0x0202,clif->pFriendsListAdd,2); // CZ_ADD_FRIENDS // 26 packet(0x022d,clif->pHomMenu,2,4); // CZ_COMMAND_MER // 5 packet(0x023b,clif->pStoragePassword,0); // CZ_ACK_STORE_PASSWORD // 36 diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 96337d32b..45683596f 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -418,11 +418,6 @@ enum packet_headers { buyingStoreUpdateItemType = 0x81b, #endif reqName = 0x95, -#if PACKETVER >= 20150503 // Confirm this? - reqNameAllType = 0xA30, -#else - reqNameAllType = 0x195, -#endif #if PACKETVER_MAIN_NUM >= 20170502 || PACKETVER_RE_NUM >= 20170419 || defined(PACKETVER_ZERO) skilWarpPointType = 0xabe, #else @@ -2787,17 +2782,46 @@ struct packet_reqname_ack { } __attribute__((packed)); // ZC_ACK_REQNAMEALL / ZC_ACK_REQNAMEALL2 -struct packet_reqnameall_ack { +#if PACKETVER_MAIN_NUM >= 20150225 || PACKETVER_RE_NUM >= 20141126 || defined(PACKETVER_ZERO) +struct PACKET_ZC_ACK_REQNAMEALL { + uint16 packet_id; + int32 gid; + char name[NAME_LENGTH]; + char party_name[NAME_LENGTH]; + char guild_name[NAME_LENGTH]; + char position_name[NAME_LENGTH]; + int32 title_id; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_ACK_REQNAMEALL, 0x0a30); +#else +struct PACKET_ZC_ACK_REQNAMEALL { uint16 packet_id; int32 gid; char name[NAME_LENGTH]; char party_name[NAME_LENGTH]; char guild_name[NAME_LENGTH]; char position_name[NAME_LENGTH]; -#if PACKETVER >= 20150503 // Confirm this? - int32 title_id; // Achievement Title +} __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_ACK_REQNAMEALL, 0x0195); #endif + +#if PACKETVER_MAIN_NUM >= 20180207 || PACKETVER_RE_NUM >= 20171129 || PACKETVER_ZERO_NUM >= 20171130 +struct PACKET_ZC_ACK_REQNAME_TITLE { + uint16 packet_id; + int32 gid; + int32 groupId; + char name[NAME_LENGTH]; + char title[NAME_LENGTH]; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_ACK_REQNAME_TITLE, 0x0adf); +#else +struct PACKET_ZC_ACK_REQNAME_TITLE { + uint16 packet_id; + int32 gid; + char name[NAME_LENGTH]; } __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_ACK_REQNAME_TITLE, 0x0095); +#endif struct PACKET_ZC_OVERWEIGHT_PERCENT { int16 packetType; @@ -3188,6 +3212,113 @@ struct PACKET_CZ_STYLE_CLOSE { DEFINE_PACKET_HEADER(CZ_STYLE_CLOSE, 0x0a48); #endif +#if PACKETVER_MAIN_NUM >= 20190403 || PACKETVER_RE_NUM >= 20190320 || PACKETVER_ZERO_NUM >= 20190410 +struct PACKET_ZC_LOAD_CONFIRM { + int16 packetType; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_LOAD_CONFIRM, 0x0b1b); +#endif + +#if PACKETVER_MAIN_NUM >= 20070911 || defined(PACKETVER_RE) || PACKETVER_AD_NUM >= 20070911 || PACKETVER_SAK_NUM >= 20070904 || defined(PACKETVER_ZERO) +struct PACKET_ZC_PARTY_CONFIG { + int16 packetType; + uint8 denyPartyInvites; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_PARTY_CONFIG, 0x02c9); +#endif + +struct PACKET_ZC_ROLE_CHANGE { + int16 packetType; + int32 flag; + char name[NAME_LENGTH]; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_ROLE_CHANGE, 0x00e1); + +#if PACKETVER_MAIN_NUM >= 20161019 || PACKETVER_RE_NUM >= 20160921 || defined(PACKETVER_ZERO) +struct PACKET_ZC_BAN_LIST_sub { + int char_id; + char message[40]; +} __attribute__((packed)); + +struct PACKET_ZC_BAN_LIST { + int16 packetType; + uint16 packetLen; + struct PACKET_ZC_BAN_LIST_sub chars[]; +} __attribute__((packed)); + +DEFINE_PACKET_HEADER(ZC_BAN_LIST, 0x0a87); +// version unconfirmed +#elif PACKETVER >= 20100803 +struct PACKET_ZC_BAN_LIST_sub { + char char_name[NAME_LENGTH]; + char message[40]; +} __attribute__((packed)); + +struct PACKET_ZC_BAN_LIST { + int16 packetType; + uint16 packetLen; + struct PACKET_ZC_BAN_LIST_sub chars[]; +} __attribute__((packed)); + +DEFINE_PACKET_HEADER(ZC_BAN_LIST, 0x0163); +#else +struct PACKET_ZC_BAN_LIST_sub { + char char_name[NAME_LENGTH]; + char account_name[NAME_LENGTH]; + char message[40]; +} __attribute__((packed)); + +struct PACKET_ZC_BAN_LIST { + int16 packetType; + uint16 packetLen; + struct PACKET_ZC_BAN_LIST_sub chars[]; +} __attribute__((packed)); + +DEFINE_PACKET_HEADER(ZC_BAN_LIST, 0x0163); +#endif + +#if PACKETVER_MAIN_NUM >= 20141008 || PACKETVER_RE_NUM >= 20140903 || defined(PACKETVER_ZERO) +struct PACKET_ZC_ACK_CLOSE_ROULETTE { + int16 packetType; + uint8 result; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_ACK_CLOSE_ROULETTE, 0x0a1e); +#endif + +#if PACKETVER_MAIN_NUM >= 20120314 || PACKETVER_RE_NUM >= 20120221 || defined(PACKETVER_ZERO) +struct PACKET_ZC_ACK_MERGE_ITEM { + int16 packetType; + int16 index; + int16 amount; + uint8 reason; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_ACK_MERGE_ITEM, 0x096f); +#endif + +#if PACKETVER_MAIN_NUM >= 20120314 || PACKETVER_RE_NUM >= 20120221 || defined(PACKETVER_ZERO) +struct PACKET_ZC_MERGE_ITEM_OPEN_sub { + int16 index; +} __attribute__((packed)); + +struct PACKET_ZC_MERGE_ITEM_OPEN { + int16 packetType; + uint16 packetLen; + struct PACKET_ZC_MERGE_ITEM_OPEN_sub items[]; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_MERGE_ITEM_OPEN, 0x096d); +#endif + +#if PACKETVER_MAIN_NUM >= 20101123 || PACKETVER_RE_NUM >= 20120328 || defined(PACKETVER_ZERO) +struct PACKET_ZC_SE_PC_BUY_CASHITEM_RESULT { + int16 packetType; + uint32 itemId; // unused + uint16 result; + uint32 cashPoints; + uint32 kafraPoints; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_SE_PC_BUY_CASHITEM_RESULT, 0x0849); +#endif + #if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute #pragma pack(pop) #endif // not NetBSD < 6 / Solaris diff --git a/src/map/party.c b/src/map/party.c index e4fb18c23..dc330d92d 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -424,6 +424,12 @@ static int party_invite(struct map_session_data *sd, struct map_session_data *ts return 0; } + if ((tsd->status.allow_party & 1) != 0) { + // party invite blocked by player + clif->party_inviteack(sd, tsd->status.name, 5); + return 0; + } + tsd->party_invite=sd->status.party_id; tsd->party_invite_account=sd->status.account_id; diff --git a/src/map/pc.c b/src/map/pc.c index 140cf7ac1..5416fbec2 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -4854,7 +4854,7 @@ static int pc_dropitem(struct map_session_data *sd, int n, int amount) if(sd->status.inventory[n].nameid <= 0 || sd->status.inventory[n].amount <= 0 || sd->status.inventory[n].amount < amount || - sd->state.trading || sd->state.vending || + sd->state.trading || sd->state.vending || sd->state.prevend || !sd->inventory_data[n] //pc->delitem would fail on this case. ) return 0; @@ -5472,7 +5472,7 @@ static int pc_putitemtocart(struct map_session_data *sd, int idx, int amount) item_data = &sd->status.inventory[idx]; - if( item_data->nameid == 0 || amount < 1 || item_data->amount < amount || sd->state.vending ) + if (item_data->nameid == 0 || amount < 1 || item_data->amount < amount || sd->state.vending || sd->state.prevend) return 1; if( (flag = pc->cart_additem(sd,item_data,amount,LOG_TYPE_NONE)) == 0 ) @@ -5519,10 +5519,10 @@ static int pc_getitemfromcart(struct map_session_data *sd, int idx, int amount) item_data=&sd->status.cart[idx]; - if(item_data->nameid==0 || amount < 1 || item_data->amount<amount || sd->state.vending ) + if (item_data->nameid == 0 || amount < 1 || item_data->amount < amount || sd->state.vending || sd->state.prevend) return 1; - if((flag = pc->additem(sd,item_data,amount,LOG_TYPE_NONE)) == 0) + if ((flag = pc->additem(sd,item_data,amount,LOG_TYPE_NONE)) == 0) return pc->cart_delitem(sd,idx,amount,0,LOG_TYPE_NONE); return flag; @@ -12356,7 +12356,7 @@ static bool pc_expandInventory(struct map_session_data *sd, int adjustSize) clif->inventoryExpandResult(sd, EXPAND_INVENTORY_RESULT_MAX_SIZE); return false; } - if (pc_isdead(sd) || sd->state.vending || sd->state.buyingstore || sd->chat_id != 0 || sd->state.trading || sd->state.storage_flag || sd->state.prevend) { + if (pc_isdead(sd) || sd->state.vending || sd->state.prevend || sd->state.buyingstore || sd->chat_id != 0 || sd->state.trading || sd->state.storage_flag || sd->state.prevend) { clif->inventoryExpandResult(sd, EXPAND_INVENTORY_RESULT_OTHER_WORK); return false; } diff --git a/src/map/script.c b/src/map/script.c index 2c5e5237b..4fb24708b 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -18961,6 +18961,20 @@ static BUILDIN(setunitdata) case UDT_ELELEVEL: setunitdata_check_bounds(4, 0, CHAR_MAX); break; + case UDT_GROUP: + { + setunitdata_check_bounds(4, 0, INT_MAX); + struct unit_data *ud = unit->bl2ud2(bl); + if (ud == NULL) { + ShowError("buildin_setunitdata: ud is NULL!\n"); + script_pushint(st, 0); + return false; + } + ud->groupId = script_getnum(st, 4); + clif->blname_ack(0, bl); // Send update to client. + script_pushint(st, 1); + return true; + } default: break; } @@ -19909,6 +19923,15 @@ static BUILDIN(getunitdata) return true;// no player attached } } + } else if (type == UDT_GROUP) { + struct unit_data *ud = unit->bl2ud(bl); + if (ud == NULL) { + ShowError("buildin_setunitdata: ud is NULL!\n"); + script_pushint(st, -1); + return false; + } + script_pushint(st, ud->groupId); + return true; } #define getunitdata_sub(idx__,var__) script->setd_sub(st,NULL,name,(idx__),(void *)h64BPTRSIZE((int)(var__)),data->ref); @@ -20372,6 +20395,46 @@ static BUILDIN(setunitname) return true; } +static BUILDIN(setunittitle) +{ + struct block_list *bl = map->id2bl(script_getnum(st, 2)); + if (bl == NULL) { + ShowWarning("buildin_setunittitle: Error in finding object with given game ID %d!\n", script_getnum(st, 2)); + return false; + } + + struct unit_data *ud = unit->bl2ud2(bl); + if (ud == NULL) { + ShowWarning("buildin_setunittitle: Error in finding unit_data for given game ID %d!\n", script_getnum(st, 2)); + return false; + } + + safestrncpy(ud->title, script_getstr(st, 3), NAME_LENGTH); + clif->blname_ack(0, bl); // Send update to client. + + return true; +} + +static BUILDIN(getunittitle) +{ + struct block_list *bl = map->id2bl(script_getnum(st, 2)); + if (bl == NULL) { + ShowWarning("buildin_getunitname: Error in finding object with given game ID %d!\n", script_getnum(st, 2)); + script_pushconststr(st, "Unknown"); + return false; + } + + struct unit_data *ud = unit->bl2ud(bl); + if (ud == NULL) { + ShowWarning("buildin_setunittitle: Error in finding unit_data for given game ID %d!\n", script_getnum(st, 2)); + return false; + } + + script_pushstrcopy(st, ud->title); + + return true; +} + /// Makes the unit walk to target position or target id /// Returns if it was successfull /// @@ -25212,6 +25275,16 @@ static BUILDIN(getInventorySize) return true; } +// force close roulette window if it opened +static BUILDIN(closeroulette) +{ + struct map_session_data *sd = script_rid2sd(st); + if (sd == NULL) + return false; + clif->roulette_close(sd); + return true; +} + /** * Adds a built-in script function. * @@ -25748,6 +25821,8 @@ static void script_parse_builtin(void) BUILDIN_DEF(getunitdata,"ii?"), BUILDIN_DEF(getunitname,"i"), BUILDIN_DEF(setunitname,"is"), + BUILDIN_DEF(getunittitle,"i"), + BUILDIN_DEF(setunittitle,"is"), BUILDIN_DEF(unitwalk,"ii?"), BUILDIN_DEF(unitkill,"i"), BUILDIN_DEF(unitwarp,"isii"), @@ -25961,6 +26036,8 @@ static void script_parse_builtin(void) BUILDIN_DEF(expandInventoryResult, "i"), BUILDIN_DEF(expandInventory, "i"), BUILDIN_DEF(getInventorySize, ""), + + BUILDIN_DEF(closeroulette, ""), }; int i, len = ARRAYLENGTH(BUILDIN); RECREATE(script->buildin, char *, script->buildin_count + len); // Pre-alloc to speed up @@ -26442,6 +26519,66 @@ static void script_hardcoded_constants(void) script->set_constant("NST_CUSTOM", NST_CUSTOM, false, false); script->set_constant("NST_BARTER", NST_BARTER, false, false); + script->constdb_comment("script unit data types"); + script->set_constant("UDT_TYPE", UDT_TYPE, false, false); + script->set_constant("UDT_SIZE", UDT_SIZE, false, false); + script->set_constant("UDT_LEVEL", UDT_LEVEL, false, false); + script->set_constant("UDT_HP", UDT_HP, false, false); + script->set_constant("UDT_MAXHP", UDT_MAXHP, false, false); + script->set_constant("UDT_SP", UDT_SP, false, false); + script->set_constant("UDT_MAXSP", UDT_MAXSP, false, false); + script->set_constant("UDT_MASTERAID", UDT_MASTERAID, false, false); + script->set_constant("UDT_MASTERCID", UDT_MASTERCID, false, false); + script->set_constant("UDT_MAPIDXY", UDT_MAPIDXY, false, true); // for setunitdata use *unitwarp, for getunitdata use *getmapxy + script->set_constant("UDT_WALKTOXY", UDT_WALKTOXY, false, true); // use *unitwalk + script->set_constant("UDT_SPEED", UDT_SPEED, false, false); + script->set_constant("UDT_MODE", UDT_MODE, false, false); + script->set_constant("UDT_AI", UDT_AI, false, false); + script->set_constant("UDT_SCOPTION", UDT_SCOPTION, false, false); + script->set_constant("UDT_SEX", UDT_SEX, false, false); + script->set_constant("UDT_CLASS", UDT_CLASS, false, false); + script->set_constant("UDT_HAIRSTYLE", UDT_HAIRSTYLE, false, false); + script->set_constant("UDT_HAIRCOLOR", UDT_HAIRCOLOR, false, false); + script->set_constant("UDT_HEADBOTTOM", UDT_HEADBOTTOM, false, false); + script->set_constant("UDT_HEADMIDDLE", UDT_HEADMIDDLE, false, false); + script->set_constant("UDT_HEADTOP", UDT_HEADTOP, false, false); + script->set_constant("UDT_CLOTHCOLOR", UDT_CLOTHCOLOR, false, false); + script->set_constant("UDT_SHIELD", UDT_SHIELD, false, false); + script->set_constant("UDT_WEAPON", UDT_WEAPON, false, false); + script->set_constant("UDT_LOOKDIR", UDT_LOOKDIR, false, false); + script->set_constant("UDT_CANMOVETICK", UDT_CANMOVETICK, false, false); + script->set_constant("UDT_STR", UDT_STR, false, false); + script->set_constant("UDT_AGI", UDT_AGI, false, false); + script->set_constant("UDT_VIT", UDT_VIT, false, false); + script->set_constant("UDT_INT", UDT_INT, false, false); + script->set_constant("UDT_DEX", UDT_DEX, false, false); + script->set_constant("UDT_LUK", UDT_LUK, false, false); + script->set_constant("UDT_ATKRANGE", UDT_ATKRANGE, false, false); + script->set_constant("UDT_ATKMIN", UDT_ATKMIN, false, false); + script->set_constant("UDT_ATKMAX", UDT_ATKMAX, false, false); + script->set_constant("UDT_MATKMIN", UDT_MATKMIN, false, false); + script->set_constant("UDT_MATKMAX", UDT_MATKMAX, false, false); + script->set_constant("UDT_DEF", UDT_DEF, false, false); + script->set_constant("UDT_MDEF", UDT_MDEF, false, false); + script->set_constant("UDT_HIT", UDT_HIT, false, false); + script->set_constant("UDT_FLEE", UDT_FLEE, false, false); + script->set_constant("UDT_PDODGE", UDT_PDODGE, false, false); + script->set_constant("UDT_CRIT", UDT_CRIT, false, false); + script->set_constant("UDT_RACE", UDT_RACE, false, false); + script->set_constant("UDT_ELETYPE", UDT_ELETYPE, false, false); + script->set_constant("UDT_ELELEVEL", UDT_ELELEVEL, false, false); + script->set_constant("UDT_AMOTION", UDT_AMOTION, false, false); + script->set_constant("UDT_ADELAY", UDT_ADELAY, false, false); + script->set_constant("UDT_DMOTION", UDT_DMOTION, false, false); + script->set_constant("UDT_HUNGER", UDT_HUNGER, false, false); + script->set_constant("UDT_INTIMACY", UDT_INTIMACY, false, false); + script->set_constant("UDT_LIFETIME", UDT_LIFETIME, false, false); + script->set_constant("UDT_MERC_KILLCOUNT", UDT_MERC_KILLCOUNT, false, false); + script->set_constant("UDT_STATPOINT", UDT_STATPOINT, false, false); + script->set_constant("UDT_ROBE", UDT_ROBE, false, false); + script->set_constant("UDT_BODY2", UDT_BODY2, false, false); + script->set_constant("UDT_GROUP", UDT_GROUP, false, false); + script->constdb_comment("Renewal"); #ifdef RENEWAL script->set_constant("RENEWAL", 1, false, false); diff --git a/src/map/script.h b/src/map/script.h index 008da9c3c..4c1cc168d 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -431,6 +431,7 @@ enum script_unit_data_types { UDT_STATPOINT, UDT_ROBE, UDT_BODY2, + UDT_GROUP, UDT_MAX }; diff --git a/src/map/trade.c b/src/map/trade.c index 9c284ba23..cef14ffe6 100644 --- a/src/map/trade.c +++ b/src/map/trade.c @@ -163,8 +163,8 @@ static void trade_tradeack(struct map_session_data *sd, int type) } //Check if you can start trade. - if (sd->npc_id || sd->state.vending || sd->state.buyingstore || sd->state.storage_flag != STORAGE_FLAG_CLOSED - || tsd->npc_id || tsd->state.vending || tsd->state.buyingstore || tsd->state.storage_flag != STORAGE_FLAG_CLOSED + if (sd->npc_id || sd->state.vending || sd->state.prevend || sd->state.buyingstore || sd->state.storage_flag != STORAGE_FLAG_CLOSED + || tsd->npc_id || tsd->state.vending || tsd->state.prevend || tsd->state.buyingstore || tsd->state.storage_flag != STORAGE_FLAG_CLOSED ) { //Fail clif->tradestart(sd, 2); diff --git a/src/map/unit.c b/src/map/unit.c index 68e6aeec1..a6805c610 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -1090,6 +1090,7 @@ static int unit_can_move(struct block_list *bl) if (sd && ( pc_issit(sd) || sd->state.vending || + sd->state.prevend || sd->state.buyingstore || sd->block_action.move )) diff --git a/src/map/unit.h b/src/map/unit.h index 5c01cdc2e..3209351e3 100644 --- a/src/map/unit.h +++ b/src/map/unit.h @@ -44,6 +44,7 @@ enum unit_stopwalking_flag { struct unit_data { struct block_list *bl; + char title[NAME_LENGTH]; struct walkpath_data walkpath; struct skill_timerskill *skilltimerskill[MAX_SKILLTIMERSKILL]; struct skill_unit_group *skillunit[MAX_SKILLUNITGROUP]; @@ -61,6 +62,7 @@ struct unit_data { int chaserange; bool stepaction; //Action should be executed on step [Playtester] int steptimer; //Timer that triggers the action [Playtester] + int groupId; // id of client side group (works for npc and may be other) [4144] uint16 stepskill_id,stepskill_lv; //Remembers skill that should be casted on step [Playtester] int64 attackabletime; int64 canact_tick; |