diff options
Diffstat (limited to 'src')
58 files changed, 2117 insertions, 714 deletions
diff --git a/src/char/char.c b/src/char/char.c index 34a3ea7a8..5528fb8aa 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -479,7 +479,8 @@ static int char_mmo_char_tosql(int char_id, struct mmo_charstatus *p) (p->show_equip != cp->show_equip) || (p->allow_party != cp->allow_party) || (p->font != cp->font) || (p->uniqueitem_counter != cp->uniqueitem_counter) || (p->hotkey_rowshift != cp->hotkey_rowshift) || (p->clan_id != cp->clan_id) || (p->last_login != cp->last_login) || (p->attendance_count != cp->attendance_count) || - (p->attendance_timer != cp->attendance_timer) || (p->title_id != cp->title_id) || (p->inventorySize != cp->inventorySize) + (p->attendance_timer != cp->attendance_timer) || (p->title_id != cp->title_id) || (p->inventorySize != cp->inventorySize) || + (p->allow_call != cp->allow_call) ) { //Save status unsigned int opt = 0; @@ -491,10 +492,12 @@ static int char_mmo_char_tosql(int char_id, struct mmo_charstatus *p) p->inventorySize = FIXED_INVENTORY_SIZE; } - if( p->allow_party ) + if (p->allow_party) opt |= OPT_ALLOW_PARTY; - if( p->show_equip ) + if (p->show_equip) opt |= OPT_SHOW_EQUIP; + if (p->allow_call) + opt |= OPT_ALLOW_CALL; if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `base_level`='%d', `job_level`='%d'," "`base_exp`='%"PRIu64"', `job_exp`='%"PRIu64"', `zeny`='%d'," @@ -1447,10 +1450,12 @@ static int char_mmo_char_fromsql(int char_id, struct mmo_charstatus *p, bool loa SQL->StmtFree(stmt); /* load options into proper vars */ - if( opt & OPT_ALLOW_PARTY ) + if (opt & OPT_ALLOW_PARTY) p->allow_party = true; - if( opt & OPT_SHOW_EQUIP ) + if (opt & OPT_SHOW_EQUIP) p->show_equip = true; + if (opt & OPT_ALLOW_CALL) + p->allow_call = true; cp = idb_ensure(chr->char_db_, char_id, chr->create_charstatus); memcpy(cp, p, sizeof(struct mmo_charstatus)); diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h index ecbfc9f2c..57b57c345 100644 --- a/src/common/HPMDataCheck.h +++ b/src/common/HPMDataCheck.h @@ -465,7 +465,6 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { { "hCSData", sizeof(struct hCSData), SERVER_TYPE_MAP }, { "merge_item", sizeof(struct merge_item), SERVER_TYPE_MAP }, { "s_packet_db", sizeof(struct s_packet_db), SERVER_TYPE_MAP }, - { "stylist_data_entry", sizeof(struct stylist_data_entry), SERVER_TYPE_MAP }, #else #define MAP_CLIF_H #endif // MAP_CLIF_H @@ -963,6 +962,12 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { #else #define MAP_STORAGE_H #endif // MAP_STORAGE_H + #ifdef MAP_STYLIST_H + { "stylist_data_entry", sizeof(struct stylist_data_entry), SERVER_TYPE_MAP }, + { "stylist_interface", sizeof(struct stylist_interface), SERVER_TYPE_MAP }, + #else + #define MAP_STYLIST_H + #endif // MAP_STYLIST_H #ifdef MAP_TRADE_H { "trade_interface", sizeof(struct trade_interface), SERVER_TYPE_MAP }, #else diff --git a/src/common/HPMSymbols.inc.h b/src/common/HPMSymbols.inc.h index 6b02b005a..9410f0586 100644 --- a/src/common/HPMSymbols.inc.h +++ b/src/common/HPMSymbols.inc.h @@ -281,6 +281,9 @@ struct stringbuf_interface *StrBuf; #ifdef COMMON_STRLIB_H /* strlib */ struct strlib_interface *strlib; #endif // COMMON_STRLIB_H +#ifdef MAP_STYLIST_H /* stylist */ +struct stylist_interface *stylist; +#endif // MAP_STYLIST_H #ifdef COMMON_STRLIB_H /* sv */ struct sv_interface *sv; #endif // COMMON_STRLIB_H @@ -646,6 +649,10 @@ HPExport const char *HPM_shared_symbols(int server_type) if ((server_type&(SERVER_TYPE_ALL)) != 0 && !HPM_SYMBOL("strlib", strlib)) return "strlib"; #endif // COMMON_STRLIB_H +#ifdef MAP_STYLIST_H /* stylist */ + if ((server_type&(SERVER_TYPE_MAP)) != 0 && !HPM_SYMBOL("stylist", stylist)) + return "stylist"; +#endif // MAP_STYLIST_H #ifdef COMMON_STRLIB_H /* sv */ if ((server_type&(SERVER_TYPE_ALL)) != 0 && !HPM_SYMBOL("sv", sv)) return "sv"; diff --git a/src/common/mmo.h b/src/common/mmo.h index 3a0f73520..2fc464243 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -487,6 +487,7 @@ enum e_mmo_charstatus_opt { OPT_NONE = 0x0, OPT_SHOW_EQUIP = 0x1, OPT_ALLOW_PARTY = 0x2, + OPT_ALLOW_CALL = 0x4, }; enum e_item_bound_type { @@ -733,7 +734,9 @@ struct mmo_charstatus { #ifdef HOTKEY_SAVING struct hotkey hotkeys[MAX_HOTKEYS]; #endif - bool show_equip, allow_party; + bool show_equip; + bool allow_party; + bool allow_call; unsigned short rename; unsigned short slotchange; diff --git a/src/common/packets/packets2019_len_main.h b/src/common/packets/packets2019_len_main.h index f7ad59577..79c8d3f51 100644 --- a/src/common/packets/packets2019_len_main.h +++ b/src/common/packets/packets2019_len_main.h @@ -2,8 +2,8 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2019 Hercules Dev Team - * Copyright (C) 2019 Andrei Karas (4144) + * Copyright (C) 2018-2019 Hercules Dev Team + * Copyright (C) 2018-2019 Andrei Karas (4144) * * Hercules is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -3787,7 +3787,7 @@ packetLen(0x0a43, 85) // ZC_ADD_MEMBER_TO_GROUP packetLen(0x0a44, -1) // ZC_GROUP_LIST // Packet: 0x0a46 -packetLen(0x0a46, 14) +packetLen(0x0a46, 14) // CZ_REQ_STYLE_CHANGE // Packet: 0x0a47 packetLen(0x0a47, 3) // ZC_STYLE_CHANGE_RES @@ -3994,13 +3994,13 @@ packetLen(0x0a95, 4) packetLen(0x0a96, 61) // ZC_ADD_EXCHANGE_ITEM4 // Packet: 0x0a97 -packetLen(0x0a97, 8) // CZ_ALT_EQUIPMENT_EQUIP +packetLen(0x0a97, 8) // CZ_ALT_EQUIPMENT_ADD // Packet: 0x0a98 packetLen(0x0a98, 10) // ZC_ALT_EQUIPMENT_EQUIP // Packet: 0x0a99 -packetLen(0x0a99, 4) +packetLen(0x0a99, 4) // CZ_ALT_EQUIPMENT_REMOVE // Packet: 0x0a9a packetLen(0x0a9a, 10) // ZC_ALT_EQUIPMENT_REMOVE @@ -4009,10 +4009,10 @@ packetLen(0x0a9a, 10) // ZC_ALT_EQUIPMENT_REMOVE packetLen(0x0a9b, -1) // ZC_ALT_EQUIPMENT_ITEMS // Packet: 0x0a9c -packetLen(0x0a9c, 2) +packetLen(0x0a9c, 2) // CZ_ALT_EQUIPMENT_SWITCH // Packet: 0x0a9d -packetLen(0x0a9d, 4) +packetLen(0x0a9d, 4) // ZC_ALT_EQUIPMENT_SWITCH_ACK // Packet: 0x0a9e packetLen(0x0a9e, 2) @@ -4168,7 +4168,7 @@ packetLen(0x0acf, 68) // CA_LOGIN_OTP packetLen(0x0ad0, 11) // CA_OTP_CODE // Packet: 0x0ad1 -packetLen(0x0ad1, -1) +packetLen(0x0ad1, -1) // AC_LOGIN_OTP // Packet: 0x0ad2 packetLen(0x0ad2, 30) @@ -4288,7 +4288,7 @@ packetLen(0x0afa, 54) packetLen(0x0afb, -1) // ZC_AUTOSPELLLIST // Packet: 0x0afc -packetLen(0x0afc, 16) +packetLen(0x0afc, 16) // CZ_REQ_STYLE_CHANGE2 // Packet: 0x0afd packetLen(0x0afd, -1) // ZC_GUILD_POSITION @@ -4375,7 +4375,62 @@ packetLen(0x0b18, 4) // ZC_INVENTORY_EXPANSION_INFO packetLen(0x0b19, 2) // CZ_INVENTORY_EXPAND_REJECTED // Packet: 0x0b1a -packetLen(0x0b1a, 29) +packetLen(0x0b1a, 29) // ZC_USESKILL_ACK3 + +// Packet: 0x0b1b +#if PACKETVER >= 20190213 +packetLen(0x0b1b, 2) // ZC_ALT_PING +#endif + +// Packet: 0x0b1c +#if PACKETVER >= 20190227 +packetLen(0x0b1c, 2) // CZ_PING +#endif + +// Packet: 0x0b1d +#if PACKETVER >= 20190227 +packetLen(0x0b1d, 2) // ZC_PING +#endif + +// Packet: 0x0b1e +#if PACKETVER >= 20190227 +packetLen(0x0b1e, 10) +#endif + +// Packet: 0x0b1f +#if PACKETVER >= 20190306 +packetLen(0x0b1f, 10) +#endif + +// Packet: 0x0b20 +#if PACKETVER >= 20190403 +packetLen(0x0b20, 271) +#endif + +// Packet: 0x0b21 +#if PACKETVER >= 20190403 +packetLen(0x0b21, 13) +#elif PACKETVER >= 20190306 +// removed +#elif PACKETVER >= 20190227 +packetLen(0x0b21, 10) +#endif + +// Packet: 0x0b22 +#if PACKETVER >= 20190403 +packetLen(0x0b22, 5) +#elif PACKETVER >= 20190306 +// removed +#elif PACKETVER >= 20190227 +packetLen(0x0b22, 6) +#endif + +// Packet: 0x0b23 +#if PACKETVER >= 20190306 +// removed +#elif PACKETVER >= 20190227 +packetLen(0x0b23, 10) +#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 134102bac..c43b65cd9 100644 --- a/src/common/packets/packets2019_len_re.h +++ b/src/common/packets/packets2019_len_re.h @@ -2,8 +2,8 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2019 Hercules Dev Team - * Copyright (C) 2019 Andrei Karas (4144) + * Copyright (C) 2018-2019 Hercules Dev Team + * Copyright (C) 2018-2019 Andrei Karas (4144) * * Hercules is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -3793,7 +3793,7 @@ packetLen(0x0a43, 85) // ZC_ADD_MEMBER_TO_GROUP packetLen(0x0a44, -1) // ZC_GROUP_LIST // Packet: 0x0a46 -packetLen(0x0a46, 14) +packetLen(0x0a46, 14) // CZ_REQ_STYLE_CHANGE // Packet: 0x0a47 packetLen(0x0a47, 3) // ZC_STYLE_CHANGE_RES @@ -4000,13 +4000,13 @@ packetLen(0x0a95, 4) packetLen(0x0a96, 61) // ZC_ADD_EXCHANGE_ITEM4 // Packet: 0x0a97 -packetLen(0x0a97, 8) // CZ_ALT_EQUIPMENT_EQUIP +packetLen(0x0a97, 8) // CZ_ALT_EQUIPMENT_ADD // Packet: 0x0a98 packetLen(0x0a98, 10) // ZC_ALT_EQUIPMENT_EQUIP // Packet: 0x0a99 -packetLen(0x0a99, 4) +packetLen(0x0a99, 4) // CZ_ALT_EQUIPMENT_REMOVE // Packet: 0x0a9a packetLen(0x0a9a, 10) // ZC_ALT_EQUIPMENT_REMOVE @@ -4015,10 +4015,10 @@ packetLen(0x0a9a, 10) // ZC_ALT_EQUIPMENT_REMOVE packetLen(0x0a9b, -1) // ZC_ALT_EQUIPMENT_ITEMS // Packet: 0x0a9c -packetLen(0x0a9c, 2) +packetLen(0x0a9c, 2) // CZ_ALT_EQUIPMENT_SWITCH // Packet: 0x0a9d -packetLen(0x0a9d, 4) +packetLen(0x0a9d, 4) // ZC_ALT_EQUIPMENT_SWITCH_ACK // Packet: 0x0a9e packetLen(0x0a9e, 2) @@ -4174,7 +4174,7 @@ packetLen(0x0acf, 68) // CA_LOGIN_OTP packetLen(0x0ad0, 11) // CA_OTP_CODE // Packet: 0x0ad1 -packetLen(0x0ad1, -1) +packetLen(0x0ad1, -1) // AC_LOGIN_OTP // Packet: 0x0ad2 packetLen(0x0ad2, 30) @@ -4294,7 +4294,7 @@ packetLen(0x0afa, 54) packetLen(0x0afb, -1) // ZC_AUTOSPELLLIST // Packet: 0x0afc -packetLen(0x0afc, 16) +packetLen(0x0afc, 16) // CZ_REQ_STYLE_CHANGE2 // Packet: 0x0afd packetLen(0x0afd, -1) // ZC_GUILD_POSITION @@ -4381,7 +4381,62 @@ packetLen(0x0b18, 4) // ZC_INVENTORY_EXPANSION_INFO packetLen(0x0b19, 2) // CZ_INVENTORY_EXPAND_REJECTED // Packet: 0x0b1a -packetLen(0x0b1a, 29) +packetLen(0x0b1a, 29) // ZC_USESKILL_ACK3 + +// Packet: 0x0b1b +#if PACKETVER >= 20190213 +packetLen(0x0b1b, 2) // ZC_ALT_PING +#endif + +// Packet: 0x0b1c +#if PACKETVER >= 20190220 +packetLen(0x0b1c, 2) // CZ_PING +#endif + +// Packet: 0x0b1d +#if PACKETVER >= 20190220 +packetLen(0x0b1d, 2) // ZC_PING +#endif + +// Packet: 0x0b1e +#if PACKETVER >= 20190227 +packetLen(0x0b1e, 10) +#endif + +// Packet: 0x0b1f +#if PACKETVER >= 20190306 +packetLen(0x0b1f, 10) +#endif + +// Packet: 0x0b20 +#if PACKETVER >= 20190403 +packetLen(0x0b20, 271) +#endif + +// Packet: 0x0b21 +#if PACKETVER >= 20190403 +packetLen(0x0b21, 13) +#elif PACKETVER >= 20190306 +// removed +#elif PACKETVER >= 20190227 +packetLen(0x0b21, 10) +#endif + +// Packet: 0x0b22 +#if PACKETVER >= 20190403 +packetLen(0x0b22, 5) +#elif PACKETVER >= 20190306 +// removed +#elif PACKETVER >= 20190227 +packetLen(0x0b22, 6) +#endif + +// Packet: 0x0b23 +#if PACKETVER >= 20190306 +// removed +#elif PACKETVER >= 20190227 +packetLen(0x0b23, 10) +#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 08e83f59f..85098505a 100644 --- a/src/common/packets/packets2019_len_zero.h +++ b/src/common/packets/packets2019_len_zero.h @@ -3787,7 +3787,7 @@ packetLen(0x0a43, 85) // ZC_ADD_MEMBER_TO_GROUP packetLen(0x0a44, -1) // ZC_GROUP_LIST // Packet: 0x0a46 -packetLen(0x0a46, 14) +packetLen(0x0a46, 14) // CZ_REQ_STYLE_CHANGE // Packet: 0x0a47 packetLen(0x0a47, 3) // ZC_STYLE_CHANGE_RES @@ -4168,7 +4168,7 @@ packetLen(0x0acf, 68) // CA_LOGIN_OTP packetLen(0x0ad0, 11) // CA_OTP_CODE // Packet: 0x0ad1 -packetLen(0x0ad1, -1) +packetLen(0x0ad1, -1) // AC_LOGIN_OTP // Packet: 0x0ad2 packetLen(0x0ad2, 30) @@ -4288,7 +4288,7 @@ packetLen(0x0afa, 54) packetLen(0x0afb, -1) // ZC_AUTOSPELLLIST // Packet: 0x0afc -packetLen(0x0afc, 16) +packetLen(0x0afc, 16) // CZ_REQ_STYLE_CHANGE2 // Packet: 0x0afd packetLen(0x0afd, -1) // ZC_GUILD_POSITION @@ -4375,11 +4375,46 @@ packetLen(0x0b18, 4) // ZC_INVENTORY_EXPANSION_INFO packetLen(0x0b19, 2) // CZ_INVENTORY_EXPAND_REJECTED // Packet: 0x0b1a -packetLen(0x0b1a, 29) +packetLen(0x0b1a, 29) // ZC_USESKILL_ACK3 // Packet: 0x0b1b #if PACKETVER >= 20190130 -packetLen(0x0b1b, 2) +packetLen(0x0b1b, 2) // ZC_ALT_PING +#endif + +// Packet: 0x0b1c +#if PACKETVER >= 20190220 +packetLen(0x0b1c, 2) // CZ_PING +#endif + +// Packet: 0x0b1d +#if PACKETVER >= 20190220 +packetLen(0x0b1d, 2) // ZC_PING +#endif + +// Packet: 0x0b1e +#if PACKETVER >= 20190313 +packetLen(0x0b1e, 10) +#endif + +// Packet: 0x0b1f +#if PACKETVER >= 20190313 +packetLen(0x0b1f, 10) +#endif + +// Packet: 0x0b20 +#if PACKETVER >= 20190327 +packetLen(0x0b20, 271) +#endif + +// Packet: 0x0b21 +#if PACKETVER >= 20190327 +packetLen(0x0b21, 13) +#endif + +// Packet: 0x0b22 +#if PACKETVER >= 20190327 +packetLen(0x0b22, 5) #endif diff --git a/src/common/socket.c b/src/common/socket.c index 95d8bf578..dc5b06da0 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -79,8 +79,6 @@ static struct socket_interface sockt_s; struct socket_interface *sockt; -static const char *SOCKET_CONF_FILENAME = "conf/common/socket.conf"; - #ifdef SEND_SHORTLIST // Add a fd to the shortlist so that it'll be recognized as a fd that needs // sending done on it. @@ -462,7 +460,7 @@ static int recv_to_fifo(int fd) socket_data_ci += len; } #endif // SHOW_SERVER_STATS - return 0; + return (int)len; } static int send_from_fifo(int fd) @@ -490,11 +488,12 @@ static int send_from_fifo(int fd) return 0; } - if( len > 0 ) + if (len > 0) { + sockt->session[fd]->wdata_tick = sockt->last_tick; // some data could not be transferred? // shift unsent data to the beginning of the queue - if( (size_t)len < sockt->session[fd]->wdata_size ) + if ((size_t)len < sockt->session[fd]->wdata_size) memmove(sockt->session[fd]->wdata, sockt->session[fd]->wdata + len, sockt->session[fd]->wdata_size - len); sockt->session[fd]->wdata_size -= len; @@ -648,9 +647,10 @@ static int make_listen_bind(uint32 ip, uint16 port) if(sockt->fd_max <= fd) sockt->fd_max = fd + 1; - create_session(fd, connect_client, null_send, null_parse); + create_session(fd, sockt->connect_client, null_send, null_parse); sockt->session[fd]->client_addr = 0; // just listens sockt->session[fd]->rdata_tick = 0; // disable timeouts on this socket + sockt->session[fd]->wdata_tick = 0; return fd; } @@ -733,6 +733,7 @@ static int create_session(int fd, RecvFunc func_recv, SendFunc func_send, ParseF sockt->session[fd]->func_send = func_send; sockt->session[fd]->func_parse = func_parse; sockt->session[fd]->rdata_tick = sockt->last_tick; + sockt->session[fd]->wdata_tick = sockt->last_tick; sockt->session[fd]->session_data = NULL; sockt->session[fd]->hdata = NULL; return 0; @@ -1505,7 +1506,7 @@ static bool socket_config_read(const char *filename, bool imported) // import should overwrite any previous configuration, so it should be called last if (libconfig->lookup_string(&config, "import", &import) == CONFIG_TRUE) { - if (strcmp(import, filename) == 0 || strcmp(import, SOCKET_CONF_FILENAME) == 0) { + if (strcmp(import, filename) == 0 || strcmp(import, sockt->SOCKET_CONF_FILENAME) == 0) { ShowWarning("socket_config_read: Loop detected! Skipping 'import'...\n"); } else { if (!socket_config_read(import, true)) @@ -1714,7 +1715,7 @@ static void socket_init(void) // Get initial local ips sockt->naddr_ = sockt->getips(sockt->addr_,16); - socket_config_read(SOCKET_CONF_FILENAME, false); + socket_config_read(sockt->SOCKET_CONF_FILENAME, false); #ifndef SOCKET_EPOLL // Select based Event Dispatcher: @@ -2143,6 +2144,8 @@ void socket_defaults(void) { sockt = &sockt_s; + sockt->SOCKET_CONF_FILENAME = "conf/common/socket.conf"; + sockt->fd_max = 0; /* */ sockt->stall_time = 60; @@ -2177,6 +2180,7 @@ void socket_defaults(void) /* */ sockt->flush = flush_fifo; sockt->flush_fifos = flush_fifos; + sockt->connect_client = connect_client; sockt->set_nonblocking = set_nonblocking; sockt->set_defaultparse = set_defaultparse; sockt->host2ip = host2ip; diff --git a/src/common/socket.h b/src/common/socket.h index 5e4251989..b20b0b07e 100644 --- a/src/common/socket.h +++ b/src/common/socket.h @@ -130,6 +130,7 @@ struct socket_data { size_t rdata_pos; uint32 last_head_size; time_t rdata_tick; // time of last recv (for detecting timeouts); zero when timeout is disabled + time_t wdata_tick; // time of last send (for detecting timeouts); RecvFunc func_recv; SendFunc func_send; @@ -178,6 +179,7 @@ struct socket_interface { time_t stall_time; time_t last_tick; + const char *SOCKET_CONF_FILENAME; /* */ uint32 addr_[16]; // ip addresses of local host (host byte order) int naddr_; // # of ip addresses @@ -212,6 +214,7 @@ struct socket_interface { /* */ void (*flush) (int fd); void (*flush_fifos) (void); + int (*connect_client) (int listen_fd); void (*set_nonblocking) (int fd, unsigned long yes); void (*set_defaultparse) (ParseFunc defaultparse); /* hostname/ip conversion functions */ diff --git a/src/map/HPMmap.c b/src/map/HPMmap.c index 6eff37df8..cbfa8e8c4 100644 --- a/src/map/HPMmap.c +++ b/src/map/HPMmap.c @@ -86,6 +86,7 @@ #include "map/skill.h" #include "map/status.h" #include "map/storage.h" +#include "map/stylist.h" #include "map/trade.h" #include "map/unit.h" #include "map/vending.h" diff --git a/src/map/Makefile.in b/src/map/Makefile.in index 3705fda0e..edb3fdaad 100644 --- a/src/map/Makefile.in +++ b/src/map/Makefile.in @@ -45,7 +45,7 @@ MAP_C = achievement.c atcommand.c battle.c battleground.c buyingstore.c channel. instance.c intif.c irc-bot.c itemdb.c log.c mail.c map.c mapreg_sql.c \ mercenary.c mob.c npc.c npc_chat.c party.c path.c pc.c pc_groups.c \ pet.c quest.c rodex.c script.c searchstore.c skill.c status.c storage.c \ - trade.c unit.c vending.c + stylist.c trade.c unit.c vending.c MAP_OBJ = $(addprefix obj_sql/, $(patsubst %c,%o,$(MAP_C))) MAP_H = achievement.h atcommand.h battle.h battleground.h buyingstore.h channel.h chat.h \ chrif.h clan.h clif.h date.h duel.h elemental.h guild.h homunculus.h HPMmap.h \ @@ -55,7 +55,7 @@ MAP_H = achievement.h atcommand.h battle.h battleground.h buyingstore.h channel. packets_keys_zero.h packets_shuffle_main.h packets_shuffle_re.h \ packets_shuffle_zero.h packets_struct.h party.h path.h pc.h pc_groups.h \ pet.h quest.h rodex.h script.h searchstore.h skill.h status.h storage.h \ - trade.h unit.h vending.h + stylist.h trade.h unit.h vending.h MAP_PH = HAVE_MYSQL=@HAVE_MYSQL@ diff --git a/src/map/achievement.c b/src/map/achievement.c index 057ea29c3..7ab80e183 100644 --- a/src/map/achievement.c +++ b/src/map/achievement.c @@ -301,6 +301,9 @@ static int achievement_validate_type(struct map_session_data *sd, enum achieveme Assert_ret(criteria->goal != 0); + if (battle_config.feature_enable_achievement == 0) + return 0; + if (type == ACH_QUEST) { ShowError("achievement_validate_type: ACH_QUEST is not handled by this function. (use achievement_validate())\n"); return 0; @@ -358,6 +361,9 @@ static bool achievement_validate(struct map_session_data *sd, int aid, unsigned Assert_retr(false, progress > 0); Assert_retr(false, obj_idx < MAX_ACHIEVEMENT_OBJECTIVES); + if (battle_config.feature_enable_achievement == 0) + return false; + if ((ad = achievement->get(aid)) == NULL) { ShowError("achievement_validate: Invalid Achievement %d provided.", aid); return false; diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 87be6ab1b..a9bbff7bd 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -7669,9 +7669,9 @@ ACMD(fakename) if (sd->fakename[0]) { sd->fakename[0] = '\0'; - clif->charnameack(0, &sd->bl); + clif->blname_ack(0, &sd->bl); if( sd->disguise ) - clif->charnameack(sd->fd, &sd->bl); + clif->blname_ack(sd->fd, &sd->bl); clif->message(sd->fd, msg_fd(fd,1307)); // Returned to real name. return true; } @@ -7687,9 +7687,9 @@ ACMD(fakename) } safestrncpy(sd->fakename, message, sizeof(sd->fakename)); - clif->charnameack(0, &sd->bl); + clif->blname_ack(0, &sd->bl); if (sd->disguise) // Another packet should be sent so the client updates the name for sd - clif->charnameack(sd->fd, &sd->bl); + clif->blname_ack(sd->fd, &sd->bl); clif->message(sd->fd, msg_fd(fd,1310)); // Fake name enabled. return true; @@ -10716,6 +10716,9 @@ void atcommand_defaults(void) { atcommand = &atcommand_s; + atcommand->atcmd_output = &atcmd_output; + atcommand->atcmd_player_name = &atcmd_player_name; + atcommand->db = NULL; atcommand->alias_db = NULL; diff --git a/src/map/atcommand.h b/src/map/atcommand.h index 3bbbefa20..1783e5dc6 100644 --- a/src/map/atcommand.h +++ b/src/map/atcommand.h @@ -21,9 +21,11 @@ #ifndef MAP_ATCOMMAND_H #define MAP_ATCOMMAND_H +#include "map/mapdefines.h" #include "map/pc_groups.h" #include "common/hercules.h" #include "common/db.h" +#include "common/mmo.h" #include <stdarg.h> @@ -90,6 +92,8 @@ struct atcmd_binding_data { * Interface **/ struct atcommand_interface { + char (*atcmd_output)[CHAT_SIZE_MAX]; + char (*atcmd_player_name)[NAME_LENGTH]; unsigned char at_symbol; unsigned char char_symbol; /* atcommand binding */ diff --git a/src/map/battle.c b/src/map/battle.c index 6fa46a7c7..fe7a64b51 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -6361,7 +6361,7 @@ static enum damage_lv battle_weapon_attack(struct block_list *src, struct block_ if (d_bl != NULL && ((d_bl->type == BL_MER && d_md->master != NULL && d_md->master->bl.id == target->id) - || (d_bl->type == BL_PC && d_sd->devotion[sce->val2] == target->id) + || (d_sd != NULL && d_bl->type == BL_PC && d_sd->devotion[sce->val2] == target->id) ) && check_distance_bl(target, d_bl, sce->val3) ) { @@ -7413,6 +7413,10 @@ static const struct battle_data { { "min_item_buy_price", &battle_config.min_item_buy_price, 1, 0, INT_MAX, }, { "min_item_sell_price", &battle_config.min_item_sell_price, 0, 0, INT_MAX, }, { "display_fake_hp_when_dead", &battle_config.display_fake_hp_when_dead, 1, 0, 1, }, + { "magicrod_type", &battle_config.magicrod_type, 0, 0, 1, }, + { "features/enable_achievement_system", &battle_config.feature_enable_achievement, 1, 0, 1, }, + { "ping_timer_inverval", &battle_config.ping_timer_interval, 30, 0, 99999999, }, + { "ping_time", &battle_config.ping_time, 20, 0, 99999999, }, }; static bool battle_set_value_sub(int index, int value) diff --git a/src/map/battle.h b/src/map/battle.h index d2fd92450..723a86874 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -576,6 +576,13 @@ struct Battle_Config { int min_item_sell_price; int display_fake_hp_when_dead; + + int magicrod_type; + + int feature_enable_achievement; + + int ping_timer_interval; + int ping_time; }; /* criteria for battle_config.idletime_critera */ diff --git a/src/map/clif.c b/src/map/clif.c index 86b130e88..109f78553 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -52,6 +52,7 @@ #include "map/script.h" #include "map/skill.h" #include "map/status.h" +#include "map/stylist.h" #include "map/storage.h" #include "map/trade.h" #include "map/unit.h" @@ -5432,7 +5433,7 @@ static void clif_useskill(struct block_list *bl, int src_id, int dst_id, int dst #if PACKETVER_MAIN_NUM >= 20091124 || PACKETVER_RE_NUM >= 20091124 || defined(PACKETVER_ZERO) p.disposable = 0; #endif -#if PACKETVER_ZERO_NUM >= 20190130 +#if PACKETVER_MAIN_NUM >= 20181212 || PACKETVER_RE_NUM >= 20181212 || PACKETVER_ZERO_NUM >= 20190130 p.unknown = 0; #endif @@ -7738,17 +7739,27 @@ static void clif_devotion(struct block_list *src, struct map_session_data *tsd) static void clif_spiritball(struct block_list *bl) { unsigned char buf[16]; - struct map_session_data *sd = BL_CAST(BL_PC,bl); - struct homun_data *hd = BL_CAST(BL_HOM,bl); nullpo_retv(bl); WBUFW(buf, 0) = 0x1d0; WBUFL(buf, 2) = bl->id; WBUFW(buf, 6) = 0; //init to 0 - switch(bl->type){ - case BL_PC: WBUFW(buf, 6) = sd->spiritball; break; - case BL_HOM: WBUFW(buf, 6) = hd->homunculus.spiritball; break; + switch (bl->type) { + case BL_PC: + { + struct map_session_data *sd = BL_CAST(BL_PC, bl); + nullpo_retv(sd); + WBUFW(buf, 6) = sd->spiritball; + break; + } + case BL_HOM: + { + struct homun_data *hd = BL_CAST(BL_HOM, bl); + nullpo_retv(hd); + WBUFW(buf, 6) = hd->homunculus.spiritball; + break; + } } clif->send(buf, packet_len(0x1d0), bl, AREA); } @@ -9227,7 +9238,7 @@ static void clif_refresh(struct map_session_data *sd) /// 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_charnameack(int fd, struct block_list *bl) +static void clif_blname_ack(int fd, struct block_list *bl) { struct packet_reqnameall_ack packet = { 0 }; int len = sizeof(struct packet_reqnameall_ack); @@ -9348,7 +9359,7 @@ static void clif_charnameack(int fd, struct block_list *bl) memcpy(packet.name, BL_UCCAST(BL_ELEM, bl)->db->name, NAME_LENGTH); break; default: - ShowError("clif_charnameack: bad type %u(%d)\n", bl->type, bl->id); + ShowError("clif_blname_ack: bad type %u(%d)\n", bl->type, bl->id); return; } @@ -10783,7 +10794,7 @@ static void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) } #endif // 0 - clif->charnameack(fd, bl); + clif->blname_ack(fd, bl); } static int clif_undisguise_timer(int tid, int64 tick, int id, intptr_t data) { @@ -15661,6 +15672,7 @@ static void clif_parse_FeelSaveOk(int fd, struct map_session_data *sd) /// 0 = sun /// 1 = moon /// 2 = star +/// 10 = Do you agree to cast the magic spell that consumes 1 Black Gemstone and 1,000,000 Zeny? static void clif_feel_req(int fd, struct map_session_data *sd, uint16 skill_lv) { nullpo_retv(sd); @@ -17009,6 +17021,9 @@ static void clif_parse_cz_config(int fd, struct map_session_data *sd) hd->homunculus.autofeed = flag; break; } + case CZ_CONFIG_CALL: + sd->status.allow_call = flag; + break; default: ShowWarning("clif_parse_cz_config: Unsupported type has been received (%u).\n", type); return; @@ -18580,6 +18595,7 @@ static void clif_search_store_info_ack(struct map_session_data *sd) /// 2 = "You cannot search anymore." (0x706) /// 3 = "You cannot search yet." (0x708) /// 4 = "No sale (purchase) information available." (0x705) +/// 362 = silent error static void clif_search_store_info_failed(struct map_session_data *sd, unsigned char reason) { #if PACKETVER >= 20100601 @@ -20947,8 +20963,8 @@ static void clif_change_title_ack(int fd, struct map_session_data *sd, int title WFIFOSET(fd, packet_len(0xa2f)); // Update names - clif->charnameack(fd, &sd->bl); - clif->charnameack(0, &sd->bl); + clif->blname_ack(fd, &sd->bl); + clif->blname_ack(0, &sd->bl); #endif } // End of Achievement System @@ -21729,6 +21745,18 @@ static void clif_open_ui(struct map_session_data *sd, enum cz_ui_types uiType) p.data = 0; #endif break; + case CZ_MACRO_REGISTER_UI: + p.UIType = ZC_CAPTCHA_UI; +#if PACKETVER >= 20171122 + p.data = 0; +#endif + break; + case CZ_MACRO_DETECTOR_UI: + p.UIType = ZC_MACRO_UI; +#if PACKETVER >= 20171122 + p.data = 0; +#endif + break; case CZ_ATTENDANCE_UI: { if (clif->attendance_getendtime() < time(NULL)) { @@ -21873,162 +21901,23 @@ static void clif_private_airship_response(struct map_session_data *sd, uint32 fl #endif } -static void clif_stylist_vector_init(void) -{ - int i; - for (i = 0; i < MAX_STYLIST_TYPE; i++) { - VECTOR_INIT(stylist_data[i]); - } -} - -static void clif_stylist_vector_clear(void) -{ - int i; - for (i = 0; i < MAX_STYLIST_TYPE; i++) { - VECTOR_CLEAR(stylist_data[i]); - } -} - -static bool clif_stylist_read_db_libconfig(void) -{ - struct config_t stylist_conf; - struct config_setting_t *stylist = NULL, *it = NULL; - const char *config_filename = "db/stylist_db.conf"; // FIXME hardcoded name - int i = 0; - - if (!libconfig->load_file(&stylist_conf, config_filename)) - return false; - - if ((stylist = libconfig->setting_get_member(stylist_conf.root, "stylist_db")) == NULL) { - ShowError("can't read %s\n", config_filename); - return false; - } - - clif->stylist_vector_clear(); - - while ((it = libconfig->setting_get_elem(stylist, i++))) { - clif->stylist_read_db_libconfig_sub(it, i - 1, config_filename); - } - - libconfig->destroy(&stylist_conf); - ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", i, config_filename); - return true; -} - -static bool clif_stylist_read_db_libconfig_sub(struct config_setting_t *it, int idx, const char *source) -{ - struct stylist_data_entry entry = { 0 }; - int i32 = 0, type = 0; - int64 i64 = 0; - - nullpo_ret(it); - nullpo_ret(source); - - if (!itemdb->lookup_const(it, "Type", &type) || type >= MAX_STYLIST_TYPE || type < 0) { - ShowWarning("clif_stylist_read_db_libconfig_sub: Invalid or missing Type (%d) in \"%s\", entry #%d, skipping.\n", type, source, idx); - return false; - } - if (!itemdb->lookup_const(it, "Id", &i32) || i32 < 0) { - ShowWarning("clif_stylist_read_db_libconfig_sub: Invalid or missing Id (%d) in \"%s\", entry #%d, skipping.\n", i32, source, idx); - return false; - } - entry.id = i32; - - if (libconfig->setting_lookup_int64(it, "Zeny", &i64)) { - if (i64 > MAX_ZENY) { - ShowWarning("clif_stylist_read_db_libconfig_sub: zeny is too big in \"%s\", entry #%d, capping to MAX_ZENY.\n", source, idx); - entry.zeny = MAX_ZENY; - } else { - entry.zeny = (int)i64; - } - } - - if (itemdb->lookup_const(it, "ItemID", &i32)) - entry.itemid = i32; - - if (itemdb->lookup_const(it, "BoxItemID", &i32)) - entry.boxid = i32; - - if (libconfig->setting_lookup_bool(it, "AllowDoram", &i32)) - entry.allow_doram = (i32 == 0) ? false : true; - - VECTOR_ENSURE(stylist_data[type], 1, 1); - VECTOR_PUSH(stylist_data[type], entry); - return true; -} - -static bool clif_style_change_validate_requirements(struct map_session_data *sd, int type, int16 idx) -{ - struct item it; - struct stylist_data_entry *entry; - - nullpo_retr(false, sd); - Assert_retr(false, type >= 0 && type < MAX_STYLIST_TYPE); - Assert_retr(false, idx >= 0 && idx < VECTOR_LENGTH(stylist_data[type])); - - entry = &VECTOR_INDEX(stylist_data[type], idx); - - if (sd->status.class == JOB_SUMMONER && (entry->allow_doram == false)) - return false; - - if (entry->id >= 0) { - if (entry->zeny != 0) { - if (sd->status.zeny < entry->zeny) - return false; - - sd->status.zeny -= entry->zeny; - clif->updatestatus(sd, SP_ZENY); - } else if (entry->itemid != 0) { - it.nameid = entry->itemid; - it.amount = 1; - return script->buildin_delitem_search(sd, &it, false); - } else if (entry->boxid != 0) { - it.nameid = entry->boxid; - it.amount = 1; - return script->buildin_delitem_search(sd, &it, false); - } - return true; - } - return false; -} -static void clif_stylist_send_rodexitem(struct map_session_data *sd, int itemid) -{ - struct rodex_message msg = { 0 }; - - nullpo_retv(sd); - - msg.receiver_id = sd->status.char_id; - msg.items[0].item.nameid = itemid; - msg.items[0].item.amount = 1; - msg.items[0].item.identify = 1; - msg.type = MAIL_TYPE_NPC | MAIL_TYPE_ITEM; - - safestrncpy(msg.sender_name, msg_txt(366), NAME_LENGTH); - safestrncpy(msg.title, msg_txt(367), RODEX_TITLE_LENGTH); - safestrncpy(msg.body, msg_txt(368), MAIL_BODY_LENGTH); - msg.send_date = (int)time(NULL); - msg.expire_date = (int)time(NULL) + RODEX_EXPIRE; - - intif->rodex_sendmail(&msg); -} - static void clif_parse_cz_req_style_change(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); static void clif_parse_cz_req_style_change(int fd, struct map_session_data *sd) { const struct PACKET_CZ_REQ_STYLE_CHANGE *p = RP2PTR(fd); if (p->HeadStyle > 0) - clif->cz_req_style_change_sub(sd, LOOK_HAIR, p->HeadStyle, false); + stylist->request_style_change(sd, LOOK_HAIR, p->HeadStyle, false); if (p->HeadPalette > 0) - clif->cz_req_style_change_sub(sd, LOOK_HAIR_COLOR, p->HeadPalette, false); + stylist->request_style_change(sd, LOOK_HAIR_COLOR, p->HeadPalette, false); if (p->BodyPalette > 0) - clif->cz_req_style_change_sub(sd, LOOK_CLOTHES_COLOR, p->BodyPalette, false); + stylist->request_style_change(sd, LOOK_CLOTHES_COLOR, p->BodyPalette, false); if (p->TopAccessory > 0) - clif->cz_req_style_change_sub(sd, LOOK_HEAD_TOP, p->TopAccessory, true); + stylist->request_style_change(sd, LOOK_HEAD_TOP, p->TopAccessory, true); if (p->MidAccessory > 0) - clif->cz_req_style_change_sub(sd, LOOK_HEAD_MID, p->MidAccessory, true); + stylist->request_style_change(sd, LOOK_HEAD_MID, p->MidAccessory, true); if (p->BottomAccessory > 0) - clif->cz_req_style_change_sub(sd, LOOK_HEAD_BOTTOM, p->BottomAccessory, true); + stylist->request_style_change(sd, LOOK_HEAD_BOTTOM, p->BottomAccessory, true); clif->style_change_response(sd, STYLIST_SHOP_SUCCESS); return; } @@ -22039,43 +21928,30 @@ static void clif_parse_cz_req_style_change2(int fd, struct map_session_data *sd) const struct PACKET_CZ_REQ_STYLE_CHANGE2 *p = RP2PTR(fd); if (p->HeadStyle > 0) - clif->cz_req_style_change_sub(sd, LOOK_HAIR, p->HeadStyle, false); + stylist->request_style_change(sd, LOOK_HAIR, p->HeadStyle, false); if (p->HeadPalette > 0) - clif->cz_req_style_change_sub(sd, LOOK_HAIR_COLOR, p->HeadPalette, false); + stylist->request_style_change(sd, LOOK_HAIR_COLOR, p->HeadPalette, false); if (p->BodyPalette > 0) - clif->cz_req_style_change_sub(sd, LOOK_CLOTHES_COLOR, p->BodyPalette, false); + stylist->request_style_change(sd, LOOK_CLOTHES_COLOR, p->BodyPalette, false); if (p->TopAccessory > 0) - clif->cz_req_style_change_sub(sd, LOOK_HEAD_TOP, p->TopAccessory, true); + stylist->request_style_change(sd, LOOK_HEAD_TOP, p->TopAccessory, true); if (p->MidAccessory > 0) - clif->cz_req_style_change_sub(sd, LOOK_HEAD_MID, p->MidAccessory, true); + stylist->request_style_change(sd, LOOK_HEAD_MID, p->MidAccessory, true); if (p->BottomAccessory > 0) - clif->cz_req_style_change_sub(sd, LOOK_HEAD_BOTTOM, p->BottomAccessory, true); + stylist->request_style_change(sd, LOOK_HEAD_BOTTOM, p->BottomAccessory, true); if (p->BodyStyle > 0) { if (pc->has_second_costume(sd)) { - clif->cz_req_style_change_sub(sd, LOOK_BODY2, p->BodyStyle, false); + stylist->request_style_change(sd, LOOK_BODY2, p->BodyStyle, false); } } clif->style_change_response(sd, STYLIST_SHOP_SUCCESS); return; } -static void clif_cz_req_style_change_sub(struct map_session_data *sd, int type, int16 idx, bool isitem) +static void clif_parse_cz_style_close(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); +static void clif_parse_cz_style_close(int fd, struct map_session_data *sd) { - struct stylist_data_entry *entry; - - nullpo_retv(sd); - Assert_retv(idx > 0); - Assert_retv(type >= 0 && type < MAX_STYLIST_TYPE); - - if ((idx - 1) < VECTOR_LENGTH(stylist_data[type])) { - entry = &VECTOR_INDEX(stylist_data[type], idx - 1); - if (clif->style_change_validate_requirements(sd, type, idx - 1)) { - if (isitem == false) - pc->changelook(sd, type, entry->id); - else - clif->stylist_send_rodexitem(sd, entry->id); - } - } + // do nothing } static void clif_style_change_response(struct map_session_data *sd, enum stylist_shop flag) @@ -22297,6 +22173,55 @@ static void clif_parse_clientVersion(int fd, struct map_session_data *sd) #endif } +static void clif_parse_ping(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_ping(int fd, struct map_session_data *sd) +{ + // do nothing, any packet update client tick +} + +static void clif_ping(struct map_session_data *sd) +{ +#if PACKETVER_MAIN_NUM >= 20190213 || PACKETVER_RE_NUM >= 20190213 || PACKETVER_ZERO_NUM >= 20190130 + nullpo_retv(sd); + struct PACKET_ZC_PING p; + p.packetType = HEADER_ZC_PING; + clif->send(&p, sizeof(p), &sd->bl, SELF); +#endif +} + +static int clif_pingTimer(int tid, int64 tick, int id, intptr_t data) +{ + map->foreachpc(clif->pingTimerSub, time(NULL)); + return 0; +} + +static int clif_pingTimerSub(struct map_session_data *sd, va_list ap) +{ + nullpo_ret(sd); + const int fd = sd->fd; + + if (!sockt->session_is_active(fd)) + { + return 0; + } + + time_t tick = va_arg(ap, time_t); + + if (sockt->session[fd]->wdata_tick + battle_config.ping_time < tick) + { + clif->ping(sd); + } + return 0; +} + +static void clif_parse_ResetCooldown(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_ResetCooldown(int fd, struct map_session_data *sd) +{ + char cmd[15]; + sprintf(cmd,"%ccddebug reset", atcommand->at_symbol); + atcommand->exec(fd, sd, cmd, true); +} + /*========================================== * Main client packet processing function *------------------------------------------*/ @@ -22578,6 +22503,12 @@ static int do_init_clif(bool minimal) clif->delay_clearunit_ers = ers_new(sizeof(struct block_list),"clif.c::delay_clearunit_ers",ERS_OPT_CLEAR); clif->delayed_damage_ers = ers_new(sizeof(struct cdelayed_damage),"clif.c::delayed_damage_ers",ERS_OPT_CLEAR); +#if PACKETVER_MAIN_NUM >= 20190403 || PACKETVER_RE_NUM >= 20190320 + timer->add_func_list(clif->pingTimer, "clif_pingTimer"); + if (battle_config.ping_timer_interval != 0) + timer->add_interval(timer->gettick() + battle_config.ping_timer_interval * 1000, clif->pingTimer, 0, 0, battle_config.ping_timer_interval * 1000); +#endif + return 0; } @@ -22775,7 +22706,7 @@ void clif_defaults(void) clif->mvp_exp = clif_mvp_exp; clif->mvp_noitem = clif_mvp_noitem; clif->changed_dir = clif_changed_dir; - clif->charnameack = clif_charnameack; + clif->blname_ack = clif_blname_ack; clif->monster_hp_bar = clif_monster_hp_bar; clif->hpmeter = clif_hpmeter; clif->hpmeter_single = clif_hpmeter_single; @@ -23459,15 +23390,9 @@ void clif_defaults(void) clif->pPrivateAirshipRequest = clif_parse_private_airship_request; clif->PrivateAirshipResponse = clif_private_airship_response; - clif->stylist_vector_init = clif_stylist_vector_init; - clif->stylist_vector_clear = clif_stylist_vector_clear; - clif->stylist_read_db_libconfig = clif_stylist_read_db_libconfig; - clif->stylist_read_db_libconfig_sub = clif_stylist_read_db_libconfig_sub; - clif->style_change_validate_requirements = clif_style_change_validate_requirements; - clif->stylist_send_rodexitem = clif_stylist_send_rodexitem; clif->pReqStyleChange = clif_parse_cz_req_style_change; clif->pReqStyleChange2 = clif_parse_cz_req_style_change2; - clif->cz_req_style_change_sub = clif_cz_req_style_change_sub; + clif->pStyleClose = clif_parse_cz_style_close; clif->style_change_response = clif_style_change_response; clif->camera_showWindow = clif_camera_showWindow; @@ -23487,4 +23412,9 @@ void clif_defaults(void) clif->pNPCBarterClosed = clif_parse_NPCBarterClosed; clif->pNPCBarterPurchase = clif_parse_NPCBarterPurchase; clif->pClientVersion = clif_parse_clientVersion; + clif->pPing = clif_parse_ping; + clif->ping = clif_ping; + clif->pingTimer = clif_pingTimer; + clif->pingTimerSub = clif_pingTimerSub; + clif->pResetCooldown = clif_parse_ResetCooldown; } diff --git a/src/map/clif.h b/src/map/clif.h index a7573b56e..367e28449 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -71,10 +71,6 @@ enum rodex_get_items; #define MAX_ROULETTE_COLUMNS 9 /** client-defined value **/ #define RGB2BGR(c) (((c) & 0x0000FF) << 16 | ((c) & 0x00FF00) | ((c) & 0xFF0000) >> 16) -#ifndef MAX_STYLIST_TYPE -#define MAX_STYLIST_TYPE LOOK_MAX -#endif - #define COLOR_CYAN 0x00ffffU #define COLOR_RED 0xff0000U #define COLOR_GREEN 0x00ff00U @@ -412,20 +408,22 @@ enum CASH_SHOP_BUY_RESULT { }; enum BATTLEGROUNDS_QUEUE_ACK { - BGQA_SUCCESS = 1, - BGQA_FAIL_QUEUING_FINISHED, - BGQA_FAIL_BGNAME_INVALID, - BGQA_FAIL_TYPE_INVALID, - BGQA_FAIL_PPL_OVERAMOUNT, - BGQA_FAIL_LEVEL_INCORRECT, - BGQA_DUPLICATE_REQUEST, - BGQA_PLEASE_RELOGIN, - BGQA_NOT_PARTY_GUILD_LEADER, - BGQA_FAIL_CLASS_INVALID, + BGQA_SUCCESS = 1, + BGQA_FAIL_QUEUING_FINISHED = 2, + BGQA_FAIL_BGNAME_INVALID = 3, + BGQA_FAIL_TYPE_INVALID = 4, + BGQA_FAIL_PPL_OVERAMOUNT = 5, + BGQA_FAIL_LEVEL_INCORRECT = 6, + BGQA_DUPLICATE_REQUEST = 7, + BGQA_PLEASE_RELOGIN = 8, + BGQA_NOT_PARTY_GUILD_LEADER = 9, + BGQA_FAIL_CLASS_INVALID = 10, /* not official way to respond (gotta find packet?) */ - BGQA_FAIL_DESERTER, - BGQA_FAIL_COOLDOWN, - BGQA_FAIL_TEAM_COUNT, + BGQA_FAIL_DESERTER = 11, + BGQA_FAIL_COOLDOWN = 12, + BGQA_FAIL_TEAM_COUNT = 13, + // official continue + BGQA_FAIL_TEAM_IN_BG_ALREADY = 15 }; enum BATTLEGROUNDS_QUEUE_NOTICE_DELETED { @@ -558,7 +556,7 @@ enum clif_unittype { **/ enum CZ_CONFIG { CZ_CONFIG_OPEN_EQUIPMENT_WINDOW = 0, - // Unknown = 1, + CZ_CONFIG_CALL = 1, CZ_CONFIG_PET_AUTOFEEDING = 2, CZ_CONFIG_HOMUNCULUS_AUTOFEEDING = 3, }; @@ -655,16 +653,6 @@ struct attendance_entry { int qty; }; -/* Stylist data [Asheraf/Hercules]*/ -struct stylist_data_entry { - int16 id; - int32 zeny; - int itemid; - int boxid; - bool allow_doram; -}; -VECTOR_DECL(struct stylist_data_entry) stylist_data[MAX_STYLIST_TYPE]; - struct barter_itemlist_entry { int addId; int addAmount; @@ -895,7 +883,7 @@ struct clif_interface { void (*mvp_exp) (struct map_session_data *sd, unsigned int exp); void (*mvp_noitem) (struct map_session_data* sd); void (*changed_dir) (struct block_list *bl, enum send_target target); - void (*charnameack) (int fd, struct block_list *bl); + void (*blname_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); @@ -1576,15 +1564,9 @@ struct clif_interface { void (*pPrivateAirshipRequest) (int fd, struct map_session_data *sd); void (*PrivateAirshipResponse) (struct map_session_data *sd, uint32 flag); - void (*stylist_vector_init) (void); - void (*stylist_vector_clear) (void); - bool (*stylist_read_db_libconfig) (void); - bool (*stylist_read_db_libconfig_sub) (struct config_setting_t *it, int idx, const char *source); - bool (*style_change_validate_requirements) (struct map_session_data *sd, int type, int16 idx); - void (*stylist_send_rodexitem) (struct map_session_data *sd, int itemid); void (*pReqStyleChange) (int fd, struct map_session_data *sd); void (*pReqStyleChange2) (int fd, struct map_session_data *sd); - void (*cz_req_style_change_sub) (struct map_session_data *sd, int type, int16 idx, bool isitem); + void (*pStyleClose) (int fd, struct map_session_data *sd); void (*style_change_response) (struct map_session_data *sd, enum stylist_shop flag); void (*pPetEvolution) (int fd, struct map_session_data *sd); void (*petEvolutionResult) (int fd, enum pet_evolution_result result); @@ -1600,6 +1582,11 @@ struct clif_interface { void (*pNPCBarterClosed) (int fd, struct map_session_data *sd); void (*pNPCBarterPurchase) (int fd, struct map_session_data *sd); void (*pClientVersion) (int fd, struct map_session_data *sd); + void (*pPing) (int fd, struct map_session_data *sd); + void (*ping) (struct map_session_data *sd); + 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); }; #ifdef HERCULES_CORE diff --git a/src/map/guild.c b/src/map/guild.c index 0517887d3..ae76b22a3 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -1899,7 +1899,7 @@ static int guild_gm_changed(int guild_id, int account_id, int char_id) if (g->member[pos].sd && g->member[pos].sd->fd) { clif->message(g->member[pos].sd->fd, msg_sd(g->member[pos].sd,878)); //"You no longer are the Guild Master." g->member[pos].sd->state.gmaster_flag = 0; - clif->charnameack(0, &g->member[pos].sd->bl); + clif->blname_ack(0, &g->member[pos].sd->bl); } if (g->member[0].sd && g->member[0].sd->fd) { @@ -1907,7 +1907,7 @@ static int guild_gm_changed(int guild_id, int account_id, int char_id) g->member[0].sd->state.gmaster_flag = 1; //Block his skills for 5 minutes to prevent abuse. guild->block_skill(g->member[0].sd, 300000); - clif->charnameack(0, &g->member[pos].sd->bl); + clif->blname_ack(0, &g->member[pos].sd->bl); } // announce the change to all guild members diff --git a/src/map/homunculus.c b/src/map/homunculus.c index aa3bb5360..f3a4c559a 100644 --- a/src/map/homunculus.c +++ b/src/map/homunculus.c @@ -779,7 +779,7 @@ static bool homunculus_change_name_ack(struct map_session_data *sd, const char * } safestrncpy(hd->homunculus.name, newname, NAME_LENGTH); aFree(newname); - clif->charnameack (0,&hd->bl); + clif->blname_ack(0,&hd->bl); hd->homunculus.rename_flag = 1; clif->hominfo(sd,hd,0); return true; diff --git a/src/map/intif.c b/src/map/intif.c index 8028d4474..86bf07bce 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -1507,7 +1507,7 @@ static void intif_parse_GuildMemberWithdraw(int fd) // ACK guild member basic info static void intif_parse_GuildMemberInfoShort(int fd) { - guild->recv_memberinfoshort(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOB(fd,14),RFIFOW(fd,15),RFIFOL(fd,17),RFIFOL(fd,19)); + guild->recv_memberinfoshort(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOB(fd,14),RFIFOW(fd,15),RFIFOL(fd,17),RFIFOL(fd,21)); } // ACK guild break diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 03f0fdc06..a61bbd008 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -2458,7 +2458,6 @@ static void itemdb_read(bool minimal) itemdb->read_chains(); itemdb->read_packages(); itemdb->read_options(); - clif->stylist_read_db_libconfig(); } /** @@ -2707,7 +2706,6 @@ static void do_final_itemdb(void) itemdb->destroy_item_data(&itemdb->dummy, 0); db_destroy(itemdb->names); VECTOR_CLEAR(clif->attendance_data); - clif->stylist_vector_clear(); } static void do_init_itemdb(bool minimal) @@ -2717,7 +2715,6 @@ static void do_init_itemdb(bool minimal) itemdb->options = idb_alloc(DB_OPT_RELEASE_DATA); itemdb->names = strdb_alloc(DB_OPT_BASE,ITEM_NAME_LENGTH); itemdb->create_dummy_data(); //Dummy data item. - clif->stylist_vector_init(); itemdb->read(minimal); if (minimal) diff --git a/src/map/map.c b/src/map/map.c index 6212493c8..7d2cc87d4 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -56,6 +56,7 @@ #include "map/skill.h" #include "map/status.h" #include "map/storage.h" +#include "map/stylist.h" #include "map/rodex.h" #include "map/trade.h" #include "map/unit.h" @@ -6197,6 +6198,7 @@ int do_final(void) vending->final(); rodex->final(); achievement->final(); + stylist->final(); HPM_map_do_final(); @@ -6404,6 +6406,7 @@ static void map_load_defaults(void) achievement_defaults(); npc_chat_defaults(); rodex_defaults(); + stylist_defaults(); } /** * --run-once handler @@ -6724,6 +6727,7 @@ int do_init(int argc, char *argv[]) duel->init(minimal); vending->init(minimal); rodex->init(minimal); + stylist->init(minimal); if (map->scriptcheck) { bool failed = map->extra_scripts_count > 0 ? false : true; diff --git a/src/map/map.h b/src/map/map.h index ace2a35a1..1f70680e8 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -45,42 +45,6 @@ enum E_MAPSERVER_ST { MAPSERVER_ST_LAST }; -#define MAX_NPC_PER_MAP 512 -#define AREA_SIZE (battle->bc->area_size) -#define CHAT_AREA_SIZE (battle->bc->chat_area_size) -#define DEAD_AREA_SIZE (battle->bc->dead_area_size) -#define DAMAGELOG_SIZE 30 -#define LOOTITEM_SIZE 10 -#define MAX_MOBSKILL 50 -#define MAX_MOB_LIST_PER_MAP 100 -#define MAX_EVENTQUEUE 2 -#define MAX_EVENTTIMER 32 -#define NATURAL_HEAL_INTERVAL 500 -#define MIN_FLOORITEM 2 -#define MAX_FLOORITEM START_ACCOUNT_NUM -#define MAX_IGNORE_LIST 20 // official is 14 -#define MAX_VENDING 12 -#define MAX_MAP_SIZE (512*512) // Wasn't there something like this already? Can't find it.. [Shinryo] - -#define BLOCK_SIZE 8 -#define block_free_max 1048576 -#define BL_LIST_MAX 1048576 - -// The following system marks a different job ID system used by the map server, -// which makes a lot more sense than the normal one. [Skotlex] -// These marks the "level" of the job. -#define JOBL_2_1 0x0100 -#define JOBL_2_2 0x0200 -#define JOBL_2 0x0300 // JOBL_2_1 | JOBL_2_2 -#define JOBL_UPPER 0x1000 -#define JOBL_BABY 0x2000 -#define JOBL_THIRD 0x4000 - -// For filtering and quick checking. -#define MAPID_BASEMASK 0x00ff -#define MAPID_UPPERMASK 0x0fff -#define MAPID_THIRDMASK (JOBL_THIRD|MAPID_UPPERMASK) - //First Jobs //Note the oddity of the novice: //Super Novices are considered the 2-1 version of the novice! Novices are considered a first class type. @@ -344,36 +308,6 @@ enum { STATIC_ASSERT(((MAPID_1_1_MAX - 1) | MAPID_BASEMASK) == MAPID_BASEMASK, "First class map IDs do not fit into MAPID_BASEMASK"); -// Max size for inputs to Graffiti, Talkie Box and Vending text prompts -#define MESSAGE_SIZE (79 + 1) -// String length you can write in the 'talking box' -#define CHATBOX_SIZE (70 + 1) -// Chatroom-related string sizes -#define CHATROOM_TITLE_SIZE (36 + 1) -#define CHATROOM_PASS_SIZE (8 + 1) -// Max allowed chat text length -#define CHAT_SIZE_MAX (255 + 1) -// 24 for npc name + 24 for label + 2 for a "::" and 1 for EOS -#define EVENT_NAME_LENGTH ( NAME_LENGTH * 2 + 3 ) -#define DEFAULT_AUTOSAVE_INTERVAL (5*60*1000) -// Specifies maps where players may hit each other -#define map_flag_vs(m) ( \ - map->list[m].flag.pvp \ - || map->list[m].flag.gvg_dungeon \ - || map->list[m].flag.gvg \ - || ((map->agit_flag || map->agit2_flag) && map->list[m].flag.gvg_castle) \ - || map->list[m].flag.battleground \ - || map->list[m].flag.cvc \ - ) -// Specifies maps that have special GvG/WoE restrictions -#define map_flag_gvg(m) (map->list[m].flag.gvg || ((map->agit_flag || map->agit2_flag) && map->list[m].flag.gvg_castle)) -// Specifies if the map is tagged as GvG/WoE (regardless of map->agit_flag status) -#define map_flag_gvg2(m) (map->list[m].flag.gvg || map->list[m].flag.gvg_castle) -// No Kill Steal Protection -#define map_flag_ks(m) (map->list[m].flag.town || map->list[m].flag.pvp || map->list[m].flag.gvg || map->list[m].flag.battleground) -// No ViewID -#define map_no_view(m, view) (map->list[m].flag.noviewid & (view)) - //This stackable implementation does not means a BL can be more than one type at a time, but it's // meant to make it easier to check for multiple types at a time on invocations such as map_foreach* calls [Skotlex] enum bl_type { @@ -392,9 +326,6 @@ enum bl_type { BL_ALL = 0xFFF, }; -// For common mapforeach calls. Since pets cannot be affected, they aren't included here yet. -#define BL_CHAR (BL_PC|BL_MOB|BL_HOM|BL_MER|BL_ELEM) - enum npc_subtype { WARP, SHOP, SCRIPT, CASHSHOP, TOMB }; /** @@ -748,16 +679,6 @@ enum map_zone_merge_type { MZMT_NEVERMERGE, ///< Cannot merge with any zones. }; -#define MAP_ZONE_NAME_LENGTH 60 -#define MAP_ZONE_ALL_NAME "All" -#define MAP_ZONE_NORMAL_NAME "Normal" -#define MAP_ZONE_PVP_NAME "PvP" -#define MAP_ZONE_GVG_NAME "GvG" -#define MAP_ZONE_BG_NAME "Battlegrounds" -#define MAP_ZONE_CVC_NAME "CvC" -#define MAP_ZONE_PK_NAME "PK Mode" -#define MAP_ZONE_MAPFLAG_LENGTH 65 - struct map_zone_data { char name[MAP_ZONE_NAME_LENGTH];/* 20'd */ enum map_zone_merge_type merge_type; diff --git a/src/map/mapdefines.h b/src/map/mapdefines.h new file mode 100644 index 000000000..df9e9bccb --- /dev/null +++ b/src/map/mapdefines.h @@ -0,0 +1,103 @@ +/** + * This file is part of Hercules. + * http://herc.ws - http://github.com/HerculesWS/Hercules + * + * Copyright (C) 2012-2018 Hercules Dev Team + * Copyright (C) Athena Dev Teams + * + * Hercules is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#ifndef MAP_MAPDEFINES_H +#define MAP_MAPDEFINES_H + +#define MAX_NPC_PER_MAP 512 +#define AREA_SIZE (battle->bc->area_size) +#define CHAT_AREA_SIZE (battle->bc->chat_area_size) +#define DEAD_AREA_SIZE (battle->bc->dead_area_size) +#define DAMAGELOG_SIZE 30 +#define LOOTITEM_SIZE 10 +#define MAX_MOBSKILL 50 +#define MAX_MOB_LIST_PER_MAP 100 +#define MAX_EVENTQUEUE 2 +#define MAX_EVENTTIMER 32 +#define NATURAL_HEAL_INTERVAL 500 +#define MIN_FLOORITEM 2 +#define MAX_FLOORITEM START_ACCOUNT_NUM +#define MAX_IGNORE_LIST 20 // official is 14 +#define MAX_VENDING 12 +#define MAX_MAP_SIZE (512*512) // Wasn't there something like this already? Can't find it.. [Shinryo] + +#define BLOCK_SIZE 8 +#define block_free_max 1048576 +#define BL_LIST_MAX 1048576 + +// The following system marks a different job ID system used by the map server, +// which makes a lot more sense than the normal one. [Skotlex] +// These marks the "level" of the job. +#define JOBL_2_1 0x0100 +#define JOBL_2_2 0x0200 +#define JOBL_2 0x0300 // JOBL_2_1 | JOBL_2_2 +#define JOBL_UPPER 0x1000 +#define JOBL_BABY 0x2000 +#define JOBL_THIRD 0x4000 + +// For filtering and quick checking. +#define MAPID_BASEMASK 0x00ff +#define MAPID_UPPERMASK 0x0fff +#define MAPID_THIRDMASK (JOBL_THIRD|MAPID_UPPERMASK) + +// Max size for inputs to Graffiti, Talkie Box and Vending text prompts +#define MESSAGE_SIZE (79 + 1) +// String length you can write in the 'talking box' +#define CHATBOX_SIZE (70 + 1) +// Chatroom-related string sizes +#define CHATROOM_TITLE_SIZE (36 + 1) +#define CHATROOM_PASS_SIZE (8 + 1) +// Max allowed chat text length +#define CHAT_SIZE_MAX (255 + 1) +// 24 for npc name + 24 for label + 2 for a "::" and 1 for EOS +#define EVENT_NAME_LENGTH ( NAME_LENGTH * 2 + 3 ) +#define DEFAULT_AUTOSAVE_INTERVAL (5*60*1000) +// Specifies maps where players may hit each other +#define map_flag_vs(m) ( \ + map->list[m].flag.pvp \ + || map->list[m].flag.gvg_dungeon \ + || map->list[m].flag.gvg \ + || ((map->agit_flag || map->agit2_flag) && map->list[m].flag.gvg_castle) \ + || map->list[m].flag.battleground \ + || map->list[m].flag.cvc \ + ) +// Specifies maps that have special GvG/WoE restrictions +#define map_flag_gvg(m) (map->list[m].flag.gvg || ((map->agit_flag || map->agit2_flag) && map->list[m].flag.gvg_castle)) +// Specifies if the map is tagged as GvG/WoE (regardless of map->agit_flag status) +#define map_flag_gvg2(m) (map->list[m].flag.gvg || map->list[m].flag.gvg_castle) +// No Kill Steal Protection +#define map_flag_ks(m) (map->list[m].flag.town || map->list[m].flag.pvp || map->list[m].flag.gvg || map->list[m].flag.battleground) +// No ViewID +#define map_no_view(m, view) (map->list[m].flag.noviewid & (view)) + +// For common mapforeach calls. Since pets cannot be affected, they aren't included here yet. +#define BL_CHAR (BL_PC|BL_MOB|BL_HOM|BL_MER|BL_ELEM) + +#define MAP_ZONE_NAME_LENGTH 60 +#define MAP_ZONE_ALL_NAME "All" +#define MAP_ZONE_NORMAL_NAME "Normal" +#define MAP_ZONE_PVP_NAME "PvP" +#define MAP_ZONE_GVG_NAME "GvG" +#define MAP_ZONE_BG_NAME "Battlegrounds" +#define MAP_ZONE_CVC_NAME "CvC" +#define MAP_ZONE_PK_NAME "PK Mode" +#define MAP_ZONE_MAPFLAG_LENGTH 65 + +#endif /* MAP_MAPDEFINES_H */ diff --git a/src/map/messages_main.h b/src/map/messages_main.h index 1ce77451e..52c953ac8 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: 20190109 +Latest version: 20190403 */ enum clif_messages { @@ -20260,9 +20260,11 @@ http://member.gnjoy.com/user/pay/chargelist.asp 한 번에 구입 가능한 아이템의 가짓수는 8개입니다. */ MSG_ID_CF0 = 0xcf0, -/*20170920 to latest +/*20170920 to 20190228 http://gift.zhaouc.com/#/index http://gift.zhaouc.com/ +20190306 to latest +http://gift.zhaouc.com/ */ MSG_ID_CF1 = 0xcf1, #endif @@ -21466,6 +21468,127 @@ TITLE */ MSG_ID_DF8 = 0xdf8, #endif +#if PACKETVER >= 20190213 +/*20190213 to latest +맵 이름 표기 +*/ + MSG_ID_DF9 = 0xdf9, +/*20190213 to latest +시스템 메세지 : 현재 노점보기 기능이 %s 상태입니다. (/노점보기) +*/ + MSG_ID_DFA = 0xdfa, +/*20190213 to latest +수직 동기 +*/ + MSG_ID_DFB = 0xdfb, +/*20190213 to latest +자료 +*/ + MSG_ID_DFC = 0xdfc, +/*20190213 to 20190228 +http://rodata.zhaouc.com/renwu.html#container +20190306 to latest +http://rodata.zhaouc.com/renwu.html +*/ + MSG_ID_DFD = 0xdfd, +/*20190213 to latest +작위 +*/ + MSG_ID_DFE = 0xdfe, +/*20190213 to latest +프레임 제한 +*/ + MSG_ID_DFF = 0xdff, +#endif +#if PACKETVER >= 20190227 +/*20190227 to latest +%d개를 초과할 경우 더 이상 설치 할 수 없습니다. +*/ + MSG_ID_E00 = 0xe00, +/*20190227 to latest +목적지 +*/ + MSG_ID_E01 = 0xe01, +#endif +#if PACKETVER >= 20190306 +/*20190306 to latest +잠시 후 다시 시도해주세요. +Please try again in a moment. +*/ + MSG_ID_E02 = 0xe02, +/*20190306 to latest +등록할 수 없는 파일입니다. +*/ + MSG_ID_E03 = 0xe03, +#endif +#if PACKETVER >= 20190320 +/*20190320 to latest +선택 삭제 +*/ + MSG_ID_E04 = 0xe04, +/*20190320 to latest +모두 삭제 +*/ + MSG_ID_E05 = 0xe05, +/*20190320 to latest +[%s]편지함의 모든 메일을 삭제하시겠습니까? +*/ + MSG_ID_E06 = 0xe06, +/*20190320 to latest +선택 받기 +*/ + MSG_ID_E07 = 0xe07, +/*20190320 to latest +모두 받기 +*/ + MSG_ID_E08 = 0xe08, +/*20190320 to latest +선택한 메일의 첨부 물품을 받으시겠습니까? +*/ + MSG_ID_E09 = 0xe09, +/*20190320 to latest +[%s]편지함의 모든 첨부 물품을 받으시겠습니까? +*/ + MSG_ID_E0A = 0xe0a, +#endif +#if PACKETVER >= 20190403 +/*20190403 to latest +스킬바2 +*/ + MSG_ID_E0B = 0xe0b, +/*20190403 to latest +스킬바 교체 +*/ + MSG_ID_E0C = 0xe0c, +/*20190403 to latest +← +*/ + MSG_ID_E0D = 0xe0d, +/*20190403 to latest +↑ +*/ + MSG_ID_E0E = 0xe0e, +/*20190403 to latest +→ +*/ + MSG_ID_E0F = 0xe0f, +/*20190403 to latest +↓ +*/ + MSG_ID_E10 = 0xe10, +/*20190403 to latest +▤ +*/ + MSG_ID_E11 = 0xe11, +/*20190403 to latest +← +*/ + MSG_ID_E12 = 0xe12, +/*20190403 to latest +로딩중에는 창을 닫을 수 없습니다. +*/ + MSG_ID_E13 = 0xe13, +#endif }; #endif /* MAP_MESSAGES_MAIN_H */ diff --git a/src/map/messages_re.h b/src/map/messages_re.h index af66a8464..3823720ad 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: 20190109 +Latest version: 20190403 */ enum clif_messages { @@ -19739,9 +19739,11 @@ http://member.gnjoy.com/user/pay/chargelist.asp 한 번에 구입 가능한 아이템의 가짓수는 8개입니다. */ MSG_ID_CF0 = 0xcf0, -/*20170920 to latest +/*20170920 to 20190228 http://gift.zhaouc.com/#/index http://gift.zhaouc.com/ +20190306 to latest +http://gift.zhaouc.com/ */ MSG_ID_CF1 = 0xcf1, #endif @@ -20945,6 +20947,127 @@ TITLE */ MSG_ID_DF8 = 0xdf8, #endif +#if PACKETVER >= 20190213 +/*20190213 to latest +맵 이름 표기 +*/ + MSG_ID_DF9 = 0xdf9, +/*20190213 to latest +시스템 메세지 : 현재 노점보기 기능이 %s 상태입니다. (/노점보기) +*/ + MSG_ID_DFA = 0xdfa, +/*20190213 to latest +수직 동기 +*/ + MSG_ID_DFB = 0xdfb, +/*20190213 to latest +자료 +*/ + MSG_ID_DFC = 0xdfc, +/*20190213 to 20190228 +http://rodata.zhaouc.com/renwu.html#container +20190306 to latest +http://rodata.zhaouc.com/renwu.html +*/ + MSG_ID_DFD = 0xdfd, +/*20190213 to latest +작위 +*/ + MSG_ID_DFE = 0xdfe, +/*20190213 to latest +프레임 제한 +*/ + MSG_ID_DFF = 0xdff, +#endif +#if PACKETVER >= 20190220 +/*20190220 to latest +%d개를 초과할 경우 더 이상 설치 할 수 없습니다. +*/ + MSG_ID_E00 = 0xe00, +/*20190220 to latest +목적지 +*/ + MSG_ID_E01 = 0xe01, +#endif +#if PACKETVER >= 20190306 +/*20190306 to latest +잠시 후 다시 시도해주세요. +Please try again in a moment. +*/ + MSG_ID_E02 = 0xe02, +/*20190306 to latest +등록할 수 없는 파일입니다. +*/ + MSG_ID_E03 = 0xe03, +#endif +#if PACKETVER >= 20190320 +/*20190320 to latest +선택 삭제 +*/ + MSG_ID_E04 = 0xe04, +/*20190320 to latest +모두 삭제 +*/ + MSG_ID_E05 = 0xe05, +/*20190320 to latest +[%s]편지함의 모든 메일을 삭제하시겠습니까? +*/ + MSG_ID_E06 = 0xe06, +/*20190320 to latest +선택 받기 +*/ + MSG_ID_E07 = 0xe07, +/*20190320 to latest +모두 받기 +*/ + MSG_ID_E08 = 0xe08, +/*20190320 to latest +선택한 메일의 첨부 물품을 받으시겠습니까? +*/ + MSG_ID_E09 = 0xe09, +/*20190320 to latest +[%s]편지함의 모든 첨부 물품을 받으시겠습니까? +*/ + MSG_ID_E0A = 0xe0a, +#endif +#if PACKETVER >= 20190403 +/*20190403 to latest +스킬바2 +*/ + MSG_ID_E0B = 0xe0b, +/*20190403 to latest +스킬바 교체 +*/ + MSG_ID_E0C = 0xe0c, +/*20190403 to latest +← +*/ + MSG_ID_E0D = 0xe0d, +/*20190403 to latest +↑ +*/ + MSG_ID_E0E = 0xe0e, +/*20190403 to latest +→ +*/ + MSG_ID_E0F = 0xe0f, +/*20190403 to latest +↓ +*/ + MSG_ID_E10 = 0xe10, +/*20190403 to latest +▤ +*/ + MSG_ID_E11 = 0xe11, +/*20190403 to latest +← +*/ + MSG_ID_E12 = 0xe12, +/*20190403 to latest +로딩중에는 창을 닫을 수 없습니다. +*/ + MSG_ID_E13 = 0xe13, +#endif }; #endif /* MAP_MESSAGES_RE_H */ diff --git a/src/map/messages_zero.h b/src/map/messages_zero.h index 0b679a2c1..90c7e8895 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: 20190130 +Latest version: 20190403 */ enum clif_messages { @@ -16356,9 +16356,11 @@ http://member.gnjoy.com/user/pay/chargelist.asp 한 번에 구입 가능한 아이템의 가짓수는 8개입니다. */ MSG_ID_CF0 = 0xcf0, -/*20171018 to latest +/*20171018 to 20190227 http://gift.zhaouc.com/#/index http://gift.zhaouc.com/ +20190313 to latest +http://gift.zhaouc.com/ */ MSG_ID_CF1 = 0xcf1, /*20171018 to latest @@ -17555,6 +17557,123 @@ TITLE */ MSG_ID_DF9 = 0xdf9, #endif +#if PACKETVER >= 20190213 +/*20190213 to latest +시스템 메세지 : 현재 노점보기 기능이 %s 상태입니다. (/노점보기) +*/ + MSG_ID_DFA = 0xdfa, +/*20190213 to latest +수직 동기 +*/ + MSG_ID_DFB = 0xdfb, +/*20190213 to latest +자료 +*/ + MSG_ID_DFC = 0xdfc, +/*20190213 to 20190227 +http://rodata.zhaouc.com/renwu.html#container +20190313 to latest +http://rodata.zhaouc.com/renwu.html +*/ + MSG_ID_DFD = 0xdfd, +/*20190213 to latest +작위 +*/ + MSG_ID_DFE = 0xdfe, +/*20190213 to latest +프레임 제한 +*/ + MSG_ID_DFF = 0xdff, +#endif +#if PACKETVER >= 20190220 +/*20190220 to latest +%d개를 초과할 경우 더 이상 설치 할 수 없습니다. +*/ + MSG_ID_E00 = 0xe00, +/*20190220 to latest +목적지 +*/ + MSG_ID_E01 = 0xe01, +#endif +#if PACKETVER >= 20190313 +/*20190313 to latest +잠시 후 다시 시도해주세요. +Please try again in a moment. +*/ + MSG_ID_E02 = 0xe02, +/*20190313 to latest +등록할 수 없는 파일입니다. +*/ + MSG_ID_E03 = 0xe03, +#endif +#if PACKETVER >= 20190327 +/*20190327 to latest +선택 삭제 +*/ + MSG_ID_E04 = 0xe04, +/*20190327 to latest +모두 삭제 +*/ + MSG_ID_E05 = 0xe05, +/*20190327 to latest +[%s]편지함의 모든 메일을 삭제하시겠습니까? +*/ + MSG_ID_E06 = 0xe06, +/*20190327 to latest +선택 받기 +*/ + MSG_ID_E07 = 0xe07, +/*20190327 to latest +모두 받기 +*/ + MSG_ID_E08 = 0xe08, +/*20190327 to latest +선택한 메일의 첨부 물품을 받으시겠습니까? +*/ + MSG_ID_E09 = 0xe09, +/*20190327 to latest +[%s]편지함의 모든 첨부 물품을 받으시겠습니까? +*/ + MSG_ID_E0A = 0xe0a, +/*20190327 to latest +스킬바2 +*/ + MSG_ID_E0B = 0xe0b, +/*20190327 to latest +스킬바 교체 +*/ + MSG_ID_E0C = 0xe0c, +#endif +#if PACKETVER >= 20190403 +/*20190403 to latest +← +*/ + MSG_ID_E0D = 0xe0d, +/*20190403 to latest +↑ +*/ + MSG_ID_E0E = 0xe0e, +/*20190403 to latest +→ +*/ + MSG_ID_E0F = 0xe0f, +/*20190403 to latest +↓ +*/ + MSG_ID_E10 = 0xe10, +/*20190403 to latest +▤ +*/ + MSG_ID_E11 = 0xe11, +/*20190403 to latest +← +*/ + MSG_ID_E12 = 0xe12, +/*20190403 to latest +로딩중에는 창을 닫을 수 없습니다. +*/ + MSG_ID_E13 = 0xe13, +#endif }; #endif /* MAP_MESSAGES_ZERO_H */ diff --git a/src/map/mob.c b/src/map/mob.c index d82e49bcc..fed4d6c60 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -2196,7 +2196,7 @@ static void mob_damage(struct mob_data *md, struct block_list *src, int damage) } if (battle_config.show_mob_info&3) - clif->charnameack (0, &md->bl); + clif->blname_ack(0, &md->bl); #if PACKETVER >= 20131223 // Resend ZC_NOTIFY_MOVEENTRY to Update the HP @@ -2796,7 +2796,7 @@ static void mob_revive(struct mob_data *md, unsigned int hp) skill->unit_move(&md->bl,tick,1); mob->skill_use(md, tick, MSC_SPAWN); if (battle_config.show_mob_info&3) - clif->charnameack (0, &md->bl); + clif->blname_ack(0, &md->bl); } static int mob_guardian_guildchange(struct mob_data *md) @@ -2921,7 +2921,7 @@ static int mob_class_change(struct mob_data *md, int class_) md->target_id = md->attacked_id = 0; //Need to update name display. - clif->charnameack(0, &md->bl); + clif->blname_ack(0, &md->bl); status_change_end(&md->bl,SC_KEEPING,INVALID_TIMER); return 0; } @@ -2933,7 +2933,7 @@ static void mob_heal(struct mob_data *md, unsigned int heal) { nullpo_retv(md); if (battle_config.show_mob_info&3) - clif->charnameack (0, &md->bl); + clif->blname_ack(0, &md->bl); #if PACKETVER >= 20131223 // Resend ZC_NOTIFY_MOVEENTRY to Update the HP if (battle_config.show_monster_hp_bar) diff --git a/src/map/npc.c b/src/map/npc.c index 61341744d..4b79a9fed 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -3911,7 +3911,7 @@ static void npc_setdisplayname(struct npc_data *nd, const char *newname) safestrncpy(nd->name, newname, sizeof(nd->name)); if( map->list[nd->bl.m].users ) - clif->charnameack(0, &nd->bl); + clif->blname_ack(0, &nd->bl); } /// Changes the display class of the npc. diff --git a/src/map/packets.h b/src/map/packets.h index 50784f09a..a0b6b7f4b 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -1777,8 +1777,10 @@ packet(0x96e,clif->ackmergeitems); #if PACKETVER >= 20151104 // new packets packet(0x0a46,clif->pReqStyleChange); + packet(0x0a48,clif->pStyleClose); #endif + // 2016-03-23aRagexeRE #if PACKETVER >= 20160323 // new packets @@ -1798,6 +1800,11 @@ packet(0x96e,clif->ackmergeitems); packet(0x0a77,clif->pCameraInfo); // CZ_CAMERA_INFO #endif +// all 20160622+ +#if PACKETVER >= 20160622 + packet(0x0a88,clif->pResetCooldown); +#endif + // 2017-02-28aRagexeRE #if PACKETVER >= 20170228 // new packets @@ -1931,4 +1938,8 @@ packet(0x96e,clif->ackmergeitems); packet(0x0b12,clif->pNPCBarterClosed); #endif +#if PACKETVER_MAIN_NUM >= 20190403 || PACKETVER_RE_NUM >= 20190320 + packet(0x0b1c,clif->pPing); +#endif + #endif /* MAP_PACKETS_H */ diff --git a/src/map/packets_keys_main.h b/src/map/packets_keys_main.h index 017e1d45a..9505fb454 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 +// 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 #if PACKETVER == 20101123 || \ PACKETVER == 20101124 || \ PACKETVER == 20101125 || \ @@ -135,7 +135,17 @@ PACKETVER == 20181226 || \ PACKETVER == 20190109 || \ PACKETVER == 20190116 || \ - PACKETVER >= 20190123 + PACKETVER == 20190123 || \ + PACKETVER == 20190213 || \ + PACKETVER == 20190220 || \ + PACKETVER == 20190227 || \ + PACKETVER == 20190228 || \ + PACKETVER == 20190306 || \ + PACKETVER == 20190313 || \ + PACKETVER == 20190320 || \ + PACKETVER == 20190322 || \ + PACKETVER == 20190327 || \ + PACKETVER >= 20190403 packetKeys(0x00000000,0x00000000,0x00000000); #endif diff --git a/src/map/packets_keys_zero.h b/src/map/packets_keys_zero.h index 10b52ae5b..e36091424 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 +// 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 #if PACKETVER == 20171018 || \ PACKETVER == 20171019 || \ PACKETVER == 20171023 || \ @@ -71,7 +71,13 @@ PACKETVER == 20181226 || \ PACKETVER == 20190116 || \ PACKETVER == 20190117 || \ - PACKETVER >= 20190130 + PACKETVER == 20190130 || \ + PACKETVER == 20190213 || \ + PACKETVER == 20190220 || \ + PACKETVER == 20190227 || \ + PACKETVER == 20190313 || \ + PACKETVER == 20190327 || \ + PACKETVER >= 20190403 packetKeys(0x00000000,0x00000000,0x00000000); #endif diff --git a/src/map/packets_shuffle_main.h b/src/map/packets_shuffle_main.h index eb6870da0..d0c3099b9 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 +// 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 #if PACKETVER == 20181121 || \ PACKETVER == 20181128 || \ PACKETVER == 20181205 || \ @@ -9736,7 +9736,16 @@ PACKETVER == 20181226 || \ PACKETVER == 20190109 || \ PACKETVER == 20190116 || \ - PACKETVER >= 20190123 + PACKETVER == 20190123 || \ + PACKETVER == 20190213 || \ + PACKETVER == 20190227 || \ + PACKETVER == 20190228 || \ + PACKETVER == 20190306 || \ + PACKETVER == 20190313 || \ + PACKETVER == 20190320 || \ + PACKETVER == 20190322 || \ + PACKETVER == 20190327 || \ + PACKETVER >= 20190403 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 8d6131560..c41095fb4 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 +// 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 #if PACKETVER == 20180704 || \ PACKETVER == 20180711 || \ PACKETVER == 20180718 || \ @@ -9686,7 +9686,16 @@ PACKETVER == 20181226 || \ PACKETVER == 20190109 || \ PACKETVER == 20190116 || \ - PACKETVER >= 20190123 + PACKETVER == 20190123 || \ + PACKETVER == 20190213 || \ + PACKETVER == 20190220 || \ + PACKETVER == 20190227 || \ + PACKETVER == 20190228 || \ + PACKETVER == 20190306 || \ + PACKETVER == 20190320 || \ + PACKETVER == 20190322 || \ + PACKETVER == 20190327 || \ + PACKETVER >= 20190403 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 4e1a78c3e..ccf11a647 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 +// 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 #if PACKETVER == 20181114 || \ PACKETVER == 20181120 || \ PACKETVER == 20181128 || \ @@ -751,7 +751,13 @@ PACKETVER == 20181226 || \ PACKETVER == 20190116 || \ PACKETVER == 20190117 || \ - PACKETVER >= 20190130 + PACKETVER == 20190130 || \ + PACKETVER == 20190213 || \ + PACKETVER == 20190220 || \ + PACKETVER == 20190227 || \ + PACKETVER == 20190313 || \ + PACKETVER == 20190327 || \ + PACKETVER >= 20190403 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 2339935ec..96337d32b 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -3111,7 +3111,7 @@ struct PACKET_CZ_NPC_BARTER_PURCHASE { DEFINE_PACKET_HEADER(CZ_NPC_BARTER_PURCHASE, 0x0b0f); #endif -#if PACKETVER_ZERO_NUM >= 20190130 +#if PACKETVER_MAIN_NUM >= 20181212 || PACKETVER_RE_NUM >= 20181212 || PACKETVER_ZERO_NUM >= 20190130 struct PACKET_ZC_USESKILL_ACK { int16 packetType; uint32 srcId; @@ -3160,6 +3160,34 @@ struct PACKET_CZ_CLIENT_VERSION { DEFINE_PACKET_HEADER(CZ_CLIENT_VERSION, 0x044a); #endif +#if PACKETVER_MAIN_NUM >= 20190227 || PACKETVER_RE_NUM >= 20190220 || PACKETVER_ZERO_NUM >= 20190220 +struct PACKET_CZ_PING { + int16 packetType; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(CZ_PING, 0x0b1c); +#endif + +#if PACKETVER_MAIN_NUM >= 20190213 || PACKETVER_RE_NUM >= 20190213 || PACKETVER_ZERO_NUM >= 20190130 +struct PACKET_ZC_PING { + int16 packetType; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_PING, 0x0b1d); +#endif + +#if PACKETVER >= 20160622 +struct PACKET_CZ_COOLDOWN_RESET { + int16 packetType; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(CZ_COOLDOWN_RESET, 0x0a88); +#endif + +#if PACKETVER >= 20151104 +struct PACKET_CZ_STYLE_CLOSE { + int16 packetType; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(CZ_STYLE_CLOSE, 0x0a48); +#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/pc.c b/src/map/pc.c index 79fa63bcf..140cf7ac1 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -8138,7 +8138,7 @@ static int pc_dead(struct map_session_data *sd, struct block_list *src) if( battle_config.show_mob_info&4 ) {// update name with new level - clif->charnameack(0, &md->bl); + clif->blname_ack(0, &md->bl); } } src = battle->get_master(src); // Maybe Player Summon diff --git a/src/map/pet.c b/src/map/pet.c index c9603a76c..96fe63c51 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -251,7 +251,7 @@ static int pet_hungry(int tid, int64 tick, int id, intptr_t data) pd->pet.hungry--; /* Pet Autofeed */ - if (battle_config.feature_enable_homun_autofeed != 0) { + if (battle_config.feature_enable_pet_autofeed != 0) { if (pd->petDB->autofeed == 1 && pd->pet.autofeed == 1 && pd->pet.hungry <= 25) { pet->food(sd, pd); } @@ -733,7 +733,7 @@ static int pet_change_name_ack(struct map_session_data *sd, const char *name, in } safestrncpy(pd->pet.name, newname, NAME_LENGTH); aFree(newname); - clif->charnameack (0,&pd->bl); + clif->blname_ack(0,&pd->bl); pd->pet.rename_flag = 1; clif->send_petdata(NULL, sd->pd, 3, sd->pd->vd.head_bottom); clif->send_petstatus(sd); diff --git a/src/map/script.c b/src/map/script.c index 7e6e06376..bfb7e9d37 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -9720,7 +9720,7 @@ static BUILDIN(statusup2) /*========================================== * Returns the number of stat points needed to change the specified stat by val. -* needed_status_point(<type>,<val>{,<char id>}); [secretdataz] +* needed_status_point(<type>,<val>); [secretdataz] *------------------------------------------*/ static BUILDIN(needed_status_point) { @@ -10604,24 +10604,36 @@ static BUILDIN(gettime) return true; } -/*========================================== +/* * GetTimeStr("TimeFMT", Length); - *------------------------------------------*/ + */ static BUILDIN(gettimestr) { char *tmpstr; const char *fmtstr; int maxlen; - time_t now = time(NULL); + time_t now; + + fmtstr = script_getstr(st, 2); + maxlen = script_getnum(st, 3); + + if (script_hasdata(st, 4)) { + int timestamp = script_getnum(st, 4); + if (timestamp < 0) { + ShowWarning("buildin_gettimestr: UNIX timestamp must be in positive value.\n"); + return false; + } - fmtstr=script_getstr(st,2); - maxlen=script_getnum(st,3); + now = (time_t)timestamp; + } else { + now = time(NULL); + } - tmpstr=(char *)aMalloc((maxlen+1)*sizeof(char)); - strftime(tmpstr,maxlen,fmtstr,localtime(&now)); - tmpstr[maxlen]='\0'; + tmpstr = (char *)aMalloc((maxlen +1)*sizeof(char)); + strftime(tmpstr, maxlen, fmtstr, localtime(&now)); + tmpstr[maxlen] = '\0'; - script_pushstr(st,tmpstr); + script_pushstr(st, tmpstr); return true; } @@ -11095,6 +11107,21 @@ static BUILDIN(killmonsterall) return true; } +static BUILDIN(killmonstergid) +{ + int mobgid = script_getnum(st, 2); + struct mob_data *md = map->id2md(mobgid); + + if (md == NULL) { + ShowWarning("buildin_killmonstergid: Error in finding monster GID '%d' or the target is not a monster.\n", mobgid); + return false; + } + + md->state.npc_killmonster = 1; + status_kill(&md->bl); + return true; +} + /*========================================== * Creates a clone of a player. * clone map, x, y, event, char_id, master_id, mode, flag, duration @@ -11730,6 +11757,18 @@ static BUILDIN(playerattached) } /*========================================== + * Used by OnTouchNPC: label to return monster GID + *------------------------------------------*/ +static BUILDIN(mobattached) +{ + if (st->rid == 0 || map->id2md(st->rid) == NULL) + script_pushint(st, 0); + else + script_pushint(st, st->rid); + return true; +} + +/*========================================== *------------------------------------------*/ static BUILDIN(announce) { @@ -14830,6 +14869,7 @@ static BUILDIN(getinventorylist) } pc->setreg(sd,reference_uid(script->add_variable("@inventorylist_expire"), j),sd->status.inventory[i].expire_time); pc->setreg(sd,reference_uid(script->add_variable("@inventorylist_bound"), j),sd->status.inventory[i].bound); + pc->setreg(sd, reference_uid(script->add_variable("@inventorylist_idx"), j), i); j++; } } @@ -15546,36 +15586,74 @@ static BUILDIN(recovery) return true; } -/*========================================== - * Get your pet info: getpetinfo(n) - * n -> 0:pet_id 1:pet_class 2:pet_name - * 3:friendly 4:hungry, 5: rename flag. - *------------------------------------------*/ +/* + * Get your current pet information + */ static BUILDIN(getpetinfo) { struct map_session_data *sd = script->rid2sd(st); - struct pet_data *pd; - int type=script_getnum(st,2); + if (sd == NULL) + return true; - if (sd == NULL || sd->pd == NULL) { - if (type == 2) - script_pushconststr(st,"null"); + struct pet_data *pd = sd->pd; + int type = script_getnum(st, 2); + if (pd == NULL) { + if (type == PETINFO_NAME) + script_pushconststr(st, "null"); else - script_pushint(st,0); + script_pushint(st, 0); return true; } - pd = sd->pd; + switch(type) { - case 0: script_pushint(st,pd->pet.pet_id); break; - case 1: script_pushint(st,pd->pet.class_); break; - case 2: script_pushstrcopy(st,pd->pet.name); break; - case 3: script_pushint(st,pd->pet.intimate); break; - case 4: script_pushint(st,pd->pet.hungry); break; - case 5: script_pushint(st,pd->pet.rename_flag); break; - default: - script_pushint(st,0); - break; + case PETINFO_ID: + script_pushint(st, pd->pet.pet_id); + break; + case PETINFO_CLASS: + script_pushint(st, pd->pet.class_); + break; + case PETINFO_NAME: + script_pushstrcopy(st, pd->pet.name); + break; + case PETINFO_INTIMACY: + script_pushint(st, pd->pet.intimate); + break; + case PETINFO_HUNGRY: + script_pushint(st, pd->pet.hungry); + break; + case PETINFO_RENAME: + script_pushint(st, pd->pet.rename_flag); + break; + case PETINFO_GID: + script_pushint(st, pd->bl.id); + break; + case PETINFO_EGGITEM: + script_pushint(st, pd->pet.egg_id); + break; + case PETINFO_FOODITEM: + script_pushint(st, pd->petDB->FoodID); + break; + case PETINFO_ACCESSORYITEM: + script_pushint(st, pd->petDB->AcceID); + break; + case PETINFO_ACCESSORYFLAG: + script_pushint(st, (pd->pet.equip != 0)? 1:0); + break; + case PETINFO_EVO_EGGID: + if (VECTOR_DATA(pd->petDB->evolve_data) != NULL) + script_pushint(st, VECTOR_DATA(pd->petDB->evolve_data)->petEggId); + else + script_pushint(st, 0); + break; + case PETINFO_AUTOFEED: + script_pushint(st, pd->pet.autofeed); + break; + default: + ShowWarning("buildin_getpetinfo: Invalid type %d.\n", type); + script_pushint(st, 0); + return false; } + return true; } @@ -15613,20 +15691,15 @@ static BUILDIN(gethominfo) return true; } -/// Retrieves information about character's mercenary -/// getmercinfo <type>[,<char id>]; +/* + * Retrieves information about character's mercenary + * getmercinfo <type>{, <char id> }; + */ static BUILDIN(getmercinfo) { - int type; - struct map_session_data* sd; - struct mercenary_data* md; - - type = script_getnum(st,2); - - if (script_hasdata(st,3)) { - int char_id = script_getnum(st,3); - - if ((sd = script->charid2sd(st, char_id)) == NULL) { + struct map_session_data *sd; + if (script_hasdata(st, 3)) { + if ((sd = script->charid2sd(st, script_getnum(st, 3))) == NULL) { script_pushnil(st); return true; } @@ -15635,27 +15708,48 @@ static BUILDIN(getmercinfo) return true; } - md = ( sd->status.mer_id && sd->md ) ? sd->md : NULL; + struct mercenary_data *md = (sd->status.mer_id && sd->md)? sd->md : NULL; + int type = script_getnum(st, 2); + if (md == NULL) { + if (type == MERCINFO_NAME) + script_pushconststr(st, ""); + else + script_pushint(st, 0); + return true; + } - switch( type ) - { - case 0: script_pushint(st,md ? md->mercenary.mercenary_id : 0); break; - case 1: script_pushint(st,md ? md->mercenary.class_ : 0); break; - case 2: - if( md ) - script_pushstrcopy(st,md->db->name); - else - script_pushconststr(st,""); - break; - case 3: script_pushint(st,md ? mercenary->get_faith(md) : 0); break; - case 4: script_pushint(st,md ? mercenary->get_calls(md) : 0); break; - case 5: script_pushint(st,md ? md->mercenary.kill_count : 0); break; - case 6: script_pushint(st,md ? mercenary->get_lifetime(md) : 0); break; - case 7: script_pushint(st,md ? md->db->lv : 0); break; - default: - ShowError("buildin_getmercinfo: Invalid type %d (char_id=%d).\n", type, sd->status.char_id); - script_pushnil(st); - return false; + switch (type) { + case MERCINFO_ID: + script_pushint(st, md->mercenary.mercenary_id); + break; + case MERCINFO_CLASS: + script_pushint(st, md->mercenary.class_); + break; + case MERCINFO_NAME: + script_pushstrcopy(st, md->db->name); + break; + case MERCINFO_FAITH: + script_pushint(st, mercenary->get_faith(md)); + break; + case MERCINFO_CALLS: + script_pushint(st, mercenary->get_calls(md)); + break; + case MERCINFO_KILLCOUNT: + script_pushint(st, md->mercenary.kill_count); + break; + case MERCINFO_LIFETIME: + script_pushint(st, mercenary->get_lifetime(md)); + break; + case MERCINFO_LEVEL: + script_pushint(st, md->db->lv); + break; + case MERCINFO_GID: + script_pushint(st, md->bl.id); + break; + default: + ShowError("buildin_getmercinfo: Invalid type %d (char_id=%d).\n", type, sd->status.char_id); + script_pushnil(st); + return false; } return true; @@ -18636,6 +18730,10 @@ static BUILDIN(getunittype) * @param4 Value#2 Optional int value to be passed for certain data types. * @param5 Value#3 Optional int value to be passed for certain data types. * @return 1 on success, 0 on failure. + + Note: Please make this script command only modify ONE INTEGER value. + If need to modify string type data, or having multiple arguments, please + introduce a new script command. */ static BUILDIN(setunitdata) { @@ -18661,7 +18759,7 @@ static BUILDIN(setunitdata) return false; } - /* Mandatory Argument 3 */ + /* Mandatory Argument 3. Subject to deprecate. */ if (type == UDT_MAPIDXY) { if (!script_isstringtype(st, 4)) { ShowError("buildin_setunitdata: Invalid data type for argument #3.\n"); @@ -18879,14 +18977,16 @@ static BUILDIN(setunitdata) break; case UDT_LEVEL: md->level = val; + if (battle_config.show_mob_info & 4) + clif->blname_ack(0, &md->bl); break; case UDT_HP: status->set_hp(bl, (unsigned int) val, STATUS_HEAL_DEFAULT); - clif->charnameack(0, &md->bl); + clif->blname_ack(0, &md->bl); break; case UDT_MAXHP: md->status.max_hp = (unsigned int) val; - clif->charnameack(0, &md->bl); + clif->blname_ack(0, &md->bl); break; case UDT_SP: status->set_sp(bl, (unsigned int) val, STATUS_HEAL_DEFAULT); @@ -19753,6 +19853,10 @@ static BUILDIN(setunitdata) * @param2 DataType Type of Data to be set for the unit. * @param3 Variable array reference to store data into. (used for UDT_MAPIDXY) * @return 0 on failure, <value> on success + + Note: Please make this script command only return ONE INTEGER value. + If the unit data having multiple arguments, or need to return in array, + please introduce a new script command. */ static BUILDIN(getunitdata) { @@ -19780,7 +19884,7 @@ static BUILDIN(getunitdata) return false; } - /* Argument checks */ + /* Argument checks. Subject to deprecate */ if (type == UDT_MAPIDXY) { if (data == NULL || !data_isreference(data)) { ShowWarning("buildin_getunitdata: Error in argument 3. Please provide a reference variable to store values in.\n"); @@ -20256,7 +20360,7 @@ static BUILDIN(setunitname) } script_pushint(st, 1); - clif->charnameack(0, bl); // Send update to client. + clif->blname_ack(0, bl); // Send update to client. return true; } @@ -21635,7 +21739,7 @@ static BUILDIN(bg_monster_set_team) mob_stop_attack(md); mob_stop_walking(md, STOPWALKING_FLAG_NONE); md->target_id = md->attacked_id = 0; - clif->charnameack(0, &md->bl); + clif->blname_ack(0, &md->bl); return true; } @@ -23687,7 +23791,7 @@ static BUILDIN(bg_create_team) if( strcmp(map_name,"-") != 0 ) { map_index = script->mapindexname2id(st,map_name); if( map_index == 0 ) { // Invalid Map - script_pushint(st,0); + script_pushint(st, -1); return true; } } @@ -25296,7 +25400,7 @@ static void script_parse_builtin(void) BUILDIN_DEF(downrefitem,"i?"), BUILDIN_DEF(statusup,"i"), BUILDIN_DEF(statusup2,"ii"), - BUILDIN_DEF(needed_status_point,"ii?"), + BUILDIN_DEF(needed_status_point, "ii"), BUILDIN_DEF(bonus,"iv"), BUILDIN_DEF2(bonus,"bonus2","ivi"), BUILDIN_DEF2(bonus,"bonus3","ivii"), @@ -25327,7 +25431,7 @@ static void script_parse_builtin(void) BUILDIN_DEF(savepoint,"sii"), BUILDIN_DEF(gettimetick,"i"), BUILDIN_DEF(gettime,"i"), - BUILDIN_DEF(gettimestr,"si"), + BUILDIN_DEF(gettimestr, "si?"), BUILDIN_DEF(openstorage,""), BUILDIN_DEF(guildopenstorage,""), BUILDIN_DEF(itemskill,"vi?"), @@ -25338,6 +25442,7 @@ static void script_parse_builtin(void) BUILDIN_DEF(areamonster,"siiiisii???"), BUILDIN_DEF(killmonster,"ss?"), BUILDIN_DEF(killmonsterall,"s?"), + BUILDIN_DEF(killmonstergid, "i"), BUILDIN_DEF(clone,"siisi????"), BUILDIN_DEF(doevent,"s"), BUILDIN_DEF(donpcevent,"s"), @@ -25354,6 +25459,7 @@ static void script_parse_builtin(void) BUILDIN_DEF(attachnpctimer,"?"), // attached the player id to the npc timer [Celest] BUILDIN_DEF(detachnpctimer,"?"), // detached the player id from the npc timer [Celest] BUILDIN_DEF(playerattached,""), // returns id of the current attached player. [Skotlex] + BUILDIN_DEF(mobattached, ""), BUILDIN_DEF(announce,"si?????"), BUILDIN_DEF(mapannounce,"ssi?????"), BUILDIN_DEF(areaannounce,"siiiisi?????"), @@ -25545,7 +25651,7 @@ static void script_parse_builtin(void) BUILDIN_DEF(getd,"s"), BUILDIN_DEF(setd,"sv"), // <--- [zBuffer] List of dynamic var commands - BUILDIN_DEF(petstat,"i"), + BUILDIN_DEF_DEPRECATED(petstat, "i"), // Deprecated 2019-03-11 BUILDIN_DEF(callshop,"s?"), // [Skotlex] BUILDIN_DEF(npcshopitem,"sii*"), // [Lance] BUILDIN_DEF(npcshopadditem,"sii*"), @@ -25843,8 +25949,11 @@ static void script_hardcoded_constants(void) script->set_constant("MAX_BG_MEMBERS",MAX_BG_MEMBERS,false, false); script->set_constant("MAX_CHAT_USERS",MAX_CHAT_USERS,false, false); script->set_constant("MAX_REFINE",MAX_REFINE,false, false); + script->set_constant("MAX_ITEM_ID",MAX_ITEM_ID,false, false); script->set_constant("MAX_MENU_OPTIONS", MAX_MENU_OPTIONS, false, false); script->set_constant("MAX_MENU_LENGTH", MAX_MENU_LENGTH, false, false); + script->set_constant("MOB_CLONE_START", MOB_CLONE_START, false, false); + script->set_constant("MOB_CLONE_END", MOB_CLONE_END, false, false); script->constdb_comment("status options"); script->set_constant("Option_Nothing",OPTION_NOTHING,false, false); @@ -26116,6 +26225,32 @@ static void script_hardcoded_constants(void) script->set_constant("ITEMINFO_VIEWSPRITE", ITEMINFO_VIEWSPRITE, false, false); script->set_constant("ITEMINFO_TRADE", ITEMINFO_TRADE, false, false); + script->constdb_comment("getmercinfo options"); + script->set_constant("MERCINFO_ID,", MERCINFO_ID, false, false); + script->set_constant("MERCINFO_CLASS", MERCINFO_CLASS, false, false); + script->set_constant("MERCINFO_NAME", MERCINFO_NAME, false, false); + script->set_constant("MERCINFO_FAITH", MERCINFO_FAITH, false, false); + script->set_constant("MERCINFO_CALLS", MERCINFO_CALLS, false, false); + script->set_constant("MERCINFO_KILLCOUNT", MERCINFO_KILLCOUNT, false, false); + script->set_constant("MERCINFO_LIFETIME", MERCINFO_LIFETIME, false, false); + script->set_constant("MERCINFO_LEVEL", MERCINFO_LEVEL, false, false); + script->set_constant("MERCINFO_GID", MERCINFO_GID, false, false); + + script->constdb_comment("getpetinfo options"); + script->set_constant("PETINFO_ID", PETINFO_ID, false, false); + script->set_constant("PETINFO_CLASS", PETINFO_CLASS, false, false); + script->set_constant("PETINFO_NAME", PETINFO_NAME, false, false); + script->set_constant("PETINFO_INTIMACY", PETINFO_INTIMACY, false, false); + script->set_constant("PETINFO_HUNGRY", PETINFO_HUNGRY, false, false); + script->set_constant("PETINFO_RENAME", PETINFO_RENAME, false, false); + script->set_constant("PETINFO_GID", PETINFO_GID, false, false); + script->set_constant("PETINFO_EGGITEM", PETINFO_EGGITEM, false, false); + script->set_constant("PETINFO_FOODITEM", PETINFO_FOODITEM, false, false); + script->set_constant("PETINFO_ACCESSORYITEM", PETINFO_ACCESSORYITEM, false, false); + script->set_constant("PETINFO_ACCESSORYFLAG", PETINFO_ACCESSORYFLAG, false, false); + script->set_constant("PETINFO_EVO_EGGID", PETINFO_EVO_EGGID, false, false); + script->set_constant("PETINFO_AUTOFEED", PETINFO_AUTOFEED, false, false); + script->constdb_comment("monster skill states"); script->set_constant("MSS_ANY", MSS_ANY, false, false); script->set_constant("MSS_IDLE", MSS_IDLE, false, false); diff --git a/src/map/script.h b/src/map/script.h index 549ad3284..008da9c3c 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -461,6 +461,44 @@ enum script_iteminfo_types { }; /** + * Mercenary Info types. + */ +enum script_mercinfo_types { + MERCINFO_ID = 0, + MERCINFO_CLASS, + MERCINFO_NAME, + MERCINFO_FAITH, + MERCINFO_CALLS, + MERCINFO_KILLCOUNT, + MERCINFO_LIFETIME, + MERCINFO_LEVEL, + MERCINFO_GID, + + MERCINFO_MAX +}; + +/** + * Pet Info types. + */ +enum script_petinfo_types { + PETINFO_ID = 0, + PETINFO_CLASS, + PETINFO_NAME, + PETINFO_INTIMACY, + PETINFO_HUNGRY, + PETINFO_RENAME, + PETINFO_GID, + PETINFO_EGGITEM, + PETINFO_FOODITEM, + PETINFO_ACCESSORYITEM, + PETINFO_ACCESSORYFLAG, + PETINFO_EVO_EGGID, + PETINFO_AUTOFEED, + + PETINFO_MAX +}; + +/** * Player blocking actions related flags. */ enum pcblock_action_flag { diff --git a/src/map/skill.c b/src/map/skill.c index 069db55df..633a73d67 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -2892,14 +2892,16 @@ static int skill_attack(int attack_type, struct block_list *src, struct block_li } #endif /* MAGIC_REFLECTION_TYPE */ } - if(sc && sc->data[SC_MAGICROD] && src == dsrc) { - int sp = skill->get_sp(skill_id,skill_lv); + if (sc && sc->data[SC_MAGICROD] && src == dsrc) { + int sp = skill->get_sp(skill_id, skill_lv); dmg.damage = dmg.damage2 = 0; dmg.dmg_lv = ATK_MISS; //This will prevent skill additional effect from taking effect. [Skotlex] sp = sp * sc->data[SC_MAGICROD]->val2 / 100; - if(skill_id == WZ_WATERBALL && skill_lv > 1) - sp = sp/((skill_lv|1)*(skill_lv|1)); //Estimate SP cost of a single water-ball + if (skill_id == WZ_WATERBALL && skill_lv > 1) + sp = sp / ((skill_lv | 1) * (skill_lv | 1)); //Estimate SP cost of a single water-ball status->heal(bl, 0, sp, STATUS_HEAL_SHOWEFFECT); + if (battle->bc->magicrod_type == 1) + clif->skill_nodamage(bl, bl, SA_MAGICROD, sc->data[SC_MAGICROD]->val1, 1); // Animation used here in eAthena [Wolfie] } } @@ -7881,8 +7883,9 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list * } break; case SA_MAGICROD: - clif->skill_nodamage(src,src,SA_MAGICROD,skill_lv,1); - sc_start(src,bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv)); + if (battle->bc->magicrod_type == 0) + clif->skill_nodamage(src, src, SA_MAGICROD, skill_lv, 1); // Animation used here in official [Wolfie] + sc_start(src, bl, type, 100, skill_lv, skill->get_time(skill_id, skill_lv)); break; case SA_AUTOSPELL: clif->skill_nodamage(src,bl,skill_id,skill_lv,1); diff --git a/src/map/stylist.c b/src/map/stylist.c new file mode 100644 index 000000000..7e7c13bf7 --- /dev/null +++ b/src/map/stylist.c @@ -0,0 +1,228 @@ +/** +* This file is part of Hercules. +* http://herc.ws - http://github.com/HerculesWS/Hercules +* +* Copyright (C) 2018-2019 Hercules Dev Team +* +* Hercules is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ +#define HERCULES_CORE + +#include "map/stylist.h" + +#include "common/conf.h" +#include "common/db.h" +#include "common/memmgr.h" +#include "common/nullpo.h" +#include "common/showmsg.h" + +#include "map/clif.h" +#include "map/intif.h" +#include "map/itemdb.h" +#include "map/pc.h" +#include "map/script.h" + +static struct stylist_interface stylist_s; +struct stylist_interface *stylist; + +static bool stylist_read_db_libconfig(void) +{ + struct config_t stylist_conf; + struct config_setting_t *stylist_db = NULL, *it = NULL; + const char *config_filename = "db/stylist_db.conf"; // FIXME hardcoded name + int i = 0; + + if (!libconfig->load_file(&stylist_conf, config_filename)) + return false; + + if ((stylist_db = libconfig->setting_get_member(stylist_conf.root, "stylist_db")) == NULL) { + ShowError("can't read %s\n", config_filename); + return false; + } + + stylist->vector_clear(); + + while ((it = libconfig->setting_get_elem(stylist_db, i++))) { + stylist->read_db_libconfig_sub(it, i - 1, config_filename); + } + + libconfig->destroy(&stylist_conf); + ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", i, config_filename); + return true; +} + +static bool stylist_read_db_libconfig_sub(struct config_setting_t *it, int idx, const char *source) +{ + struct stylist_data_entry entry = { 0 }; + int i32 = 0, type = 0; + int64 i64 = 0; + + nullpo_ret(it); + nullpo_ret(source); + + if (!itemdb->lookup_const(it, "Type", &type) || type >= MAX_STYLIST_TYPE || type < 0) { + ShowWarning("stylist_read_db_libconfig_sub: Invalid or missing Type (%d) in \"%s\", entry #%d, skipping.\n", type, source, idx); + return false; + } + if (!itemdb->lookup_const(it, "Id", &i32) || i32 < 0) { + ShowWarning("stylist_read_db_libconfig_sub: Invalid or missing Id (%d) in \"%s\", entry #%d, skipping.\n", i32, source, idx); + return false; + } + entry.id = i32; + + if (libconfig->setting_lookup_int64(it, "Zeny", &i64)) { + if (i64 > MAX_ZENY) { + ShowWarning("stylist_read_db_libconfig_sub: zeny is too big in \"%s\", entry #%d, capping to MAX_ZENY.\n", source, idx); + entry.zeny = MAX_ZENY; + } else { + entry.zeny = (int)i64; + } + } + + if (itemdb->lookup_const(it, "ItemID", &i32)) + entry.itemid = i32; + + if (itemdb->lookup_const(it, "BoxItemID", &i32)) + entry.boxid = i32; + + if (libconfig->setting_lookup_bool(it, "AllowDoram", &i32)) + entry.allow_doram = (i32 == 0) ? false : true; + + VECTOR_ENSURE(stylist->data[type], 1, 1); + VECTOR_PUSH(stylist->data[type], entry); + return true; +} + +static bool stylist_validate_requirements(struct map_session_data *sd, int type, int16 idx) +{ + struct item it; + struct stylist_data_entry *entry; + + nullpo_retr(false, sd); + Assert_retr(false, type >= 0 && type < MAX_STYLIST_TYPE); + Assert_retr(false, idx >= 0 && idx < VECTOR_LENGTH(stylist->data[type])); + + entry = &VECTOR_INDEX(stylist->data[type], idx); + + if (sd->status.class == JOB_SUMMONER && (entry->allow_doram == false)) + return false; + + if (entry->id >= 0) { + if (entry->zeny != 0) { + if (sd->status.zeny < entry->zeny) + return false; + + sd->status.zeny -= entry->zeny; + clif->updatestatus(sd, SP_ZENY); + } else if (entry->itemid != 0) { + it.nameid = entry->itemid; + it.amount = 1; + return script->buildin_delitem_search(sd, &it, false); + } else if (entry->boxid != 0) { + it.nameid = entry->boxid; + it.amount = 1; + return script->buildin_delitem_search(sd, &it, false); + } + return true; + } + return false; +} + +static void stylist_send_rodexitem(struct map_session_data *sd, int itemid) +{ + struct rodex_message msg = { 0 }; + + nullpo_retv(sd); + + msg.receiver_id = sd->status.char_id; + msg.items[0].item.nameid = itemid; + msg.items[0].item.amount = 1; + msg.items[0].item.identify = 1; + msg.type = MAIL_TYPE_NPC | MAIL_TYPE_ITEM; + + safestrncpy(msg.sender_name, msg_txt(366), NAME_LENGTH); + safestrncpy(msg.title, msg_txt(367), RODEX_TITLE_LENGTH); + safestrncpy(msg.body, msg_txt(368), MAIL_BODY_LENGTH); + msg.send_date = (int)time(NULL); + msg.expire_date = (int)time(NULL) + RODEX_EXPIRE; + + intif->rodex_sendmail(&msg); +} + +static void stylist_request_style_change(struct map_session_data *sd, int type, int16 idx, bool isitem) +{ + struct stylist_data_entry *entry; + + nullpo_retv(sd); + Assert_retv(idx > 0); + Assert_retv(type >= 0 && type < MAX_STYLIST_TYPE); + + if ((idx - 1) < VECTOR_LENGTH(stylist->data[type])) { + entry = &VECTOR_INDEX(stylist->data[type], idx - 1); + if (stylist->validate_requirements(sd, type, idx - 1)) { + if (isitem == false) + pc->changelook(sd, type, entry->id); + else + stylist->send_rodexitem(sd, entry->id); + } + } +} + +static void stylist_vector_init(void) +{ + for (int i = 0; i < MAX_STYLIST_TYPE; i++) + VECTOR_INIT(stylist->data[i]); +} +static void stylist_vector_clear(void) +{ + for (int i = 0; i < MAX_STYLIST_TYPE; i++) + VECTOR_CLEAR(stylist->data[i]); +} + +static void do_init_stylist(bool minimal) +{ + if (minimal) + return; + + // Initialize the db + stylist->vector_init(); + + // Load the db + stylist->read_db_libconfig(); +} + +static void do_final_stylist(void) +{ + // Clear the db + stylist->vector_clear(); +} + +void stylist_defaults(void) +{ + stylist = &stylist_s; + + /* core */ + stylist->init = do_init_stylist; + stylist->final = do_final_stylist; + /* */ + stylist->vector_init = stylist_vector_init; + stylist->vector_clear = stylist_vector_clear; + /* database */ + stylist->read_db_libconfig = stylist_read_db_libconfig; + stylist->read_db_libconfig_sub = stylist_read_db_libconfig_sub; + /* */ + stylist->request_style_change = stylist_request_style_change; + stylist->validate_requirements = stylist_validate_requirements; + stylist->send_rodexitem = stylist_send_rodexitem; +} diff --git a/src/map/stylist.h b/src/map/stylist.h new file mode 100644 index 000000000..5bedfefc7 --- /dev/null +++ b/src/map/stylist.h @@ -0,0 +1,69 @@ +/** + * This file is part of Hercules. + * http://herc.ws - http://github.com/HerculesWS/Hercules + * + * Copyright (C) 2018-2019 Hercules Dev Team + * + * Hercules is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#ifndef MAP_STYLIST_H +#define MAP_STYLIST_H + +#include "common/hercules.h" +#include "map/map.h" // LOOK_MAX + +struct map_session_data; + +/* Maximum available types for stylist */ +#ifndef MAX_STYLIST_TYPE +#define MAX_STYLIST_TYPE LOOK_MAX +#endif + +/* Stylist data [Asheraf/Hercules]*/ +struct stylist_data_entry { + int16 id; + int32 zeny; + int itemid; + int boxid; + bool allow_doram; +}; + +/** + * stylist.c Interface + **/ +struct stylist_interface { + VECTOR_DECL(struct stylist_data_entry) data[MAX_STYLIST_TYPE]; + + void (*init) (bool minimal); + void (*final) (void); + + void (*vector_init) (void); + void (*vector_clear) (void); + + bool (*read_db_libconfig) (void); + bool (*read_db_libconfig_sub) (struct config_setting_t *it, int idx, const char *source); + + void (*request_style_change) (struct map_session_data *sd, int type, int16 idx, bool isitem); + bool (*validate_requirements) (struct map_session_data *sd, int type, int16 idx); + void (*send_rodexitem) (struct map_session_data *sd, int itemid); + +}; + +#ifdef HERCULES_CORE +void stylist_defaults(void); +#endif // HERCULES_CORE + +HPShared struct stylist_interface *stylist; ///< Pointer to the stylist interface. + +#endif /* MAP_STYLIST_H */ diff --git a/src/plugins/HPMHooking.c b/src/plugins/HPMHooking.c index aef09d7a7..f95a3a92d 100644 --- a/src/plugins/HPMHooking.c +++ b/src/plugins/HPMHooking.c @@ -110,6 +110,7 @@ PRAGMA_GCC5(GCC diagnostic ignored "-Wdiscarded-qualifiers") #include "map/skill.h" #include "map/status.h" #include "map/storage.h" +#include "map/stylist.h" #include "map/trade.h" #include "map/unit.h" #include "common/grfio.h" diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index 7cc5ef2b1..f3b4370fb 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -1378,8 +1378,8 @@ typedef void (*HPMHOOK_pre_clif_mvp_noitem) (struct map_session_data **sd); typedef void (*HPMHOOK_post_clif_mvp_noitem) (struct map_session_data *sd); typedef void (*HPMHOOK_pre_clif_changed_dir) (struct block_list **bl, enum send_target *target); typedef void (*HPMHOOK_post_clif_changed_dir) (struct block_list *bl, enum send_target target); -typedef void (*HPMHOOK_pre_clif_charnameack) (int *fd, struct block_list **bl); -typedef void (*HPMHOOK_post_clif_charnameack) (int fd, struct block_list *bl); +typedef void (*HPMHOOK_pre_clif_blname_ack) (int *fd, struct block_list **bl); +typedef void (*HPMHOOK_post_clif_blname_ack) (int fd, struct block_list *bl); typedef void (*HPMHOOK_pre_clif_monster_hp_bar) (struct mob_data **md, struct map_session_data **sd); typedef void (*HPMHOOK_post_clif_monster_hp_bar) (struct mob_data *md, struct map_session_data *sd); typedef int (*HPMHOOK_pre_clif_hpmeter) (struct map_session_data **sd); @@ -2620,24 +2620,10 @@ typedef void (*HPMHOOK_pre_clif_pPrivateAirshipRequest) (int *fd, struct map_ses typedef void (*HPMHOOK_post_clif_pPrivateAirshipRequest) (int fd, struct map_session_data *sd); typedef void (*HPMHOOK_pre_clif_PrivateAirshipResponse) (struct map_session_data **sd, uint32 *flag); typedef void (*HPMHOOK_post_clif_PrivateAirshipResponse) (struct map_session_data *sd, uint32 flag); -typedef void (*HPMHOOK_pre_clif_stylist_vector_init) (void); -typedef void (*HPMHOOK_post_clif_stylist_vector_init) (void); -typedef void (*HPMHOOK_pre_clif_stylist_vector_clear) (void); -typedef void (*HPMHOOK_post_clif_stylist_vector_clear) (void); -typedef bool (*HPMHOOK_pre_clif_stylist_read_db_libconfig) (void); -typedef bool (*HPMHOOK_post_clif_stylist_read_db_libconfig) (bool retVal___); -typedef bool (*HPMHOOK_pre_clif_stylist_read_db_libconfig_sub) (struct config_setting_t **it, int *idx, const char **source); -typedef bool (*HPMHOOK_post_clif_stylist_read_db_libconfig_sub) (bool retVal___, struct config_setting_t *it, int idx, const char *source); -typedef bool (*HPMHOOK_pre_clif_style_change_validate_requirements) (struct map_session_data **sd, int *type, int16 *idx); -typedef bool (*HPMHOOK_post_clif_style_change_validate_requirements) (bool retVal___, struct map_session_data *sd, int type, int16 idx); -typedef void (*HPMHOOK_pre_clif_stylist_send_rodexitem) (struct map_session_data **sd, int *itemid); -typedef void (*HPMHOOK_post_clif_stylist_send_rodexitem) (struct map_session_data *sd, int itemid); typedef void (*HPMHOOK_pre_clif_pReqStyleChange) (int *fd, struct map_session_data **sd); typedef void (*HPMHOOK_post_clif_pReqStyleChange) (int fd, struct map_session_data *sd); typedef void (*HPMHOOK_pre_clif_pReqStyleChange2) (int *fd, struct map_session_data **sd); typedef void (*HPMHOOK_post_clif_pReqStyleChange2) (int fd, struct map_session_data *sd); -typedef void (*HPMHOOK_pre_clif_cz_req_style_change_sub) (struct map_session_data **sd, int *type, int16 *idx, bool *isitem); -typedef void (*HPMHOOK_post_clif_cz_req_style_change_sub) (struct map_session_data *sd, int type, int16 idx, bool isitem); typedef void (*HPMHOOK_pre_clif_style_change_response) (struct map_session_data **sd, enum stylist_shop *flag); typedef void (*HPMHOOK_post_clif_style_change_response) (struct map_session_data *sd, enum stylist_shop flag); typedef void (*HPMHOOK_pre_clif_pPetEvolution) (int *fd, struct map_session_data **sd); @@ -2668,6 +2654,16 @@ typedef void (*HPMHOOK_pre_clif_pNPCBarterPurchase) (int *fd, struct map_session typedef void (*HPMHOOK_post_clif_pNPCBarterPurchase) (int fd, struct map_session_data *sd); typedef void (*HPMHOOK_pre_clif_pClientVersion) (int *fd, struct map_session_data **sd); typedef void (*HPMHOOK_post_clif_pClientVersion) (int fd, struct map_session_data *sd); +typedef void (*HPMHOOK_pre_clif_pPing) (int *fd, struct map_session_data **sd); +typedef void (*HPMHOOK_post_clif_pPing) (int fd, struct map_session_data *sd); +typedef void (*HPMHOOK_pre_clif_ping) (struct map_session_data **sd); +typedef void (*HPMHOOK_post_clif_ping) (struct map_session_data *sd); +typedef int (*HPMHOOK_pre_clif_pingTimer) (int *tid, int64 *tick, int *id, intptr_t *data); +typedef int (*HPMHOOK_post_clif_pingTimer) (int retVal___, int tid, int64 tick, int id, intptr_t data); +typedef int (*HPMHOOK_pre_clif_pingTimerSub) (struct map_session_data **sd, va_list ap); +typedef int (*HPMHOOK_post_clif_pingTimerSub) (int retVal___, struct map_session_data *sd, va_list ap); +typedef void (*HPMHOOK_pre_clif_pResetCooldown) (int *fd, struct map_session_data **sd); +typedef void (*HPMHOOK_post_clif_pResetCooldown) (int fd, struct map_session_data *sd); #endif // MAP_CLIF_H #ifdef COMMON_CORE_H /* cmdline */ typedef void (*HPMHOOK_pre_cmdline_init) (void); @@ -7538,6 +7534,8 @@ typedef void (*HPMHOOK_pre_sockt_flush) (int *fd); typedef void (*HPMHOOK_post_sockt_flush) (int fd); typedef void (*HPMHOOK_pre_sockt_flush_fifos) (void); typedef void (*HPMHOOK_post_sockt_flush_fifos) (void); +typedef int (*HPMHOOK_pre_sockt_connect_client) (int *listen_fd); +typedef int (*HPMHOOK_post_sockt_connect_client) (int retVal___, int listen_fd); typedef void (*HPMHOOK_pre_sockt_set_nonblocking) (int *fd, unsigned long *yes); typedef void (*HPMHOOK_post_sockt_set_nonblocking) (int fd, unsigned long yes); typedef void (*HPMHOOK_pre_sockt_set_defaultparse) (ParseFunc *defaultparse); @@ -7969,6 +7967,26 @@ typedef int (*HPMHOOK_post_strlib_strline_) (int retVal___, const char *str, siz typedef bool (*HPMHOOK_pre_strlib_bin2hex_) (char **output, const unsigned char **input, size_t *count); typedef bool (*HPMHOOK_post_strlib_bin2hex_) (bool retVal___, char *output, const unsigned char *input, size_t count); #endif // COMMON_STRLIB_H +#ifdef MAP_STYLIST_H /* stylist */ +typedef void (*HPMHOOK_pre_stylist_init) (bool *minimal); +typedef void (*HPMHOOK_post_stylist_init) (bool minimal); +typedef void (*HPMHOOK_pre_stylist_final) (void); +typedef void (*HPMHOOK_post_stylist_final) (void); +typedef void (*HPMHOOK_pre_stylist_vector_init) (void); +typedef void (*HPMHOOK_post_stylist_vector_init) (void); +typedef void (*HPMHOOK_pre_stylist_vector_clear) (void); +typedef void (*HPMHOOK_post_stylist_vector_clear) (void); +typedef bool (*HPMHOOK_pre_stylist_read_db_libconfig) (void); +typedef bool (*HPMHOOK_post_stylist_read_db_libconfig) (bool retVal___); +typedef bool (*HPMHOOK_pre_stylist_read_db_libconfig_sub) (struct config_setting_t **it, int *idx, const char **source); +typedef bool (*HPMHOOK_post_stylist_read_db_libconfig_sub) (bool retVal___, struct config_setting_t *it, int idx, const char *source); +typedef void (*HPMHOOK_pre_stylist_request_style_change) (struct map_session_data **sd, int *type, int16 *idx, bool *isitem); +typedef void (*HPMHOOK_post_stylist_request_style_change) (struct map_session_data *sd, int type, int16 idx, bool isitem); +typedef bool (*HPMHOOK_pre_stylist_validate_requirements) (struct map_session_data **sd, int *type, int16 *idx); +typedef bool (*HPMHOOK_post_stylist_validate_requirements) (bool retVal___, struct map_session_data *sd, int type, int16 idx); +typedef void (*HPMHOOK_pre_stylist_send_rodexitem) (struct map_session_data **sd, int *itemid); +typedef void (*HPMHOOK_post_stylist_send_rodexitem) (struct map_session_data *sd, int itemid); +#endif // MAP_STYLIST_H #ifdef COMMON_STRLIB_H /* sv */ typedef int (*HPMHOOK_pre_sv_parse_next) (struct s_svstate **svstate); typedef int (*HPMHOOK_post_sv_parse_next) (int retVal___, struct s_svstate *svstate); diff --git a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc index a8b4860f3..dbabf8ed4 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc @@ -1422,6 +1422,8 @@ struct { struct HPMHookPoint *HP_sockt_flush_post; struct HPMHookPoint *HP_sockt_flush_fifos_pre; struct HPMHookPoint *HP_sockt_flush_fifos_post; + struct HPMHookPoint *HP_sockt_connect_client_pre; + struct HPMHookPoint *HP_sockt_connect_client_post; struct HPMHookPoint *HP_sockt_set_nonblocking_pre; struct HPMHookPoint *HP_sockt_set_nonblocking_post; struct HPMHookPoint *HP_sockt_set_defaultparse_pre; @@ -3059,6 +3061,8 @@ struct { int HP_sockt_flush_post; int HP_sockt_flush_fifos_pre; int HP_sockt_flush_fifos_post; + int HP_sockt_connect_client_pre; + int HP_sockt_connect_client_post; int HP_sockt_set_nonblocking_pre; int HP_sockt_set_nonblocking_post; int HP_sockt_set_defaultparse_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc index 56c5bcfb7..f666ad1fd 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc @@ -758,6 +758,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(sockt->session_is_active, HP_sockt_session_is_active) }, { HP_POP(sockt->flush, HP_sockt_flush) }, { HP_POP(sockt->flush_fifos, HP_sockt_flush_fifos) }, + { HP_POP(sockt->connect_client, HP_sockt_connect_client) }, { HP_POP(sockt->set_nonblocking, HP_sockt_set_nonblocking) }, { HP_POP(sockt->set_defaultparse, HP_sockt_set_defaultparse) }, { HP_POP(sockt->host2ip, HP_sockt_host2ip) }, diff --git a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc index 0bd61ba15..edffe7c11 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc @@ -18686,6 +18686,33 @@ void HP_sockt_flush_fifos(void) { } return; } +int HP_sockt_connect_client(int listen_fd) { + int hIndex = 0; + int retVal___ = 0; + if (HPMHooks.count.HP_sockt_connect_client_pre > 0) { + int (*preHookFunc) (int *listen_fd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_connect_client_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_sockt_connect_client_pre[hIndex].func; + retVal___ = preHookFunc(&listen_fd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.sockt.connect_client(listen_fd); + } + if (HPMHooks.count.HP_sockt_connect_client_post > 0) { + int (*postHookFunc) (int retVal___, int listen_fd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_connect_client_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_sockt_connect_client_post[hIndex].func; + retVal___ = postHookFunc(retVal___, listen_fd); + } + } + return retVal___; +} void HP_sockt_set_nonblocking(int fd, unsigned long yes) { int hIndex = 0; if (HPMHooks.count.HP_sockt_set_nonblocking_pre > 0) { diff --git a/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc index 7293e8fc4..ba0fe05c2 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc @@ -584,6 +584,8 @@ struct { struct HPMHookPoint *HP_sockt_flush_post; struct HPMHookPoint *HP_sockt_flush_fifos_pre; struct HPMHookPoint *HP_sockt_flush_fifos_post; + struct HPMHookPoint *HP_sockt_connect_client_pre; + struct HPMHookPoint *HP_sockt_connect_client_post; struct HPMHookPoint *HP_sockt_set_nonblocking_pre; struct HPMHookPoint *HP_sockt_set_nonblocking_post; struct HPMHookPoint *HP_sockt_set_defaultparse_pre; @@ -1383,6 +1385,8 @@ struct { int HP_sockt_flush_post; int HP_sockt_flush_fifos_pre; int HP_sockt_flush_fifos_post; + int HP_sockt_connect_client_pre; + int HP_sockt_connect_client_post; int HP_sockt_set_nonblocking_pre; int HP_sockt_set_nonblocking_post; int HP_sockt_set_defaultparse_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc index 825e049b1..1e3548621 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc @@ -326,6 +326,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(sockt->session_is_active, HP_sockt_session_is_active) }, { HP_POP(sockt->flush, HP_sockt_flush) }, { HP_POP(sockt->flush_fifos, HP_sockt_flush_fifos) }, + { HP_POP(sockt->connect_client, HP_sockt_connect_client) }, { HP_POP(sockt->set_nonblocking, HP_sockt_set_nonblocking) }, { HP_POP(sockt->set_defaultparse, HP_sockt_set_defaultparse) }, { HP_POP(sockt->host2ip, HP_sockt_host2ip) }, diff --git a/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc index 044ee2df2..080fb75ff 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc @@ -7495,6 +7495,33 @@ void HP_sockt_flush_fifos(void) { } return; } +int HP_sockt_connect_client(int listen_fd) { + int hIndex = 0; + int retVal___ = 0; + if (HPMHooks.count.HP_sockt_connect_client_pre > 0) { + int (*preHookFunc) (int *listen_fd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_connect_client_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_sockt_connect_client_pre[hIndex].func; + retVal___ = preHookFunc(&listen_fd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.sockt.connect_client(listen_fd); + } + if (HPMHooks.count.HP_sockt_connect_client_post > 0) { + int (*postHookFunc) (int retVal___, int listen_fd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_connect_client_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_sockt_connect_client_post[hIndex].func; + retVal___ = postHookFunc(retVal___, listen_fd); + } + } + return retVal___; +} void HP_sockt_set_nonblocking(int fd, unsigned long yes) { int hIndex = 0; if (HPMHooks.count.HP_sockt_set_nonblocking_pre > 0) { diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index b323d77e6..99d6be230 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -968,8 +968,8 @@ struct { struct HPMHookPoint *HP_clif_mvp_noitem_post; struct HPMHookPoint *HP_clif_changed_dir_pre; struct HPMHookPoint *HP_clif_changed_dir_post; - struct HPMHookPoint *HP_clif_charnameack_pre; - struct HPMHookPoint *HP_clif_charnameack_post; + struct HPMHookPoint *HP_clif_blname_ack_pre; + struct HPMHookPoint *HP_clif_blname_ack_post; struct HPMHookPoint *HP_clif_monster_hp_bar_pre; struct HPMHookPoint *HP_clif_monster_hp_bar_post; struct HPMHookPoint *HP_clif_hpmeter_pre; @@ -2210,24 +2210,10 @@ struct { struct HPMHookPoint *HP_clif_pPrivateAirshipRequest_post; struct HPMHookPoint *HP_clif_PrivateAirshipResponse_pre; struct HPMHookPoint *HP_clif_PrivateAirshipResponse_post; - struct HPMHookPoint *HP_clif_stylist_vector_init_pre; - struct HPMHookPoint *HP_clif_stylist_vector_init_post; - struct HPMHookPoint *HP_clif_stylist_vector_clear_pre; - struct HPMHookPoint *HP_clif_stylist_vector_clear_post; - struct HPMHookPoint *HP_clif_stylist_read_db_libconfig_pre; - struct HPMHookPoint *HP_clif_stylist_read_db_libconfig_post; - struct HPMHookPoint *HP_clif_stylist_read_db_libconfig_sub_pre; - struct HPMHookPoint *HP_clif_stylist_read_db_libconfig_sub_post; - struct HPMHookPoint *HP_clif_style_change_validate_requirements_pre; - struct HPMHookPoint *HP_clif_style_change_validate_requirements_post; - struct HPMHookPoint *HP_clif_stylist_send_rodexitem_pre; - struct HPMHookPoint *HP_clif_stylist_send_rodexitem_post; struct HPMHookPoint *HP_clif_pReqStyleChange_pre; struct HPMHookPoint *HP_clif_pReqStyleChange_post; struct HPMHookPoint *HP_clif_pReqStyleChange2_pre; struct HPMHookPoint *HP_clif_pReqStyleChange2_post; - struct HPMHookPoint *HP_clif_cz_req_style_change_sub_pre; - struct HPMHookPoint *HP_clif_cz_req_style_change_sub_post; struct HPMHookPoint *HP_clif_style_change_response_pre; struct HPMHookPoint *HP_clif_style_change_response_post; struct HPMHookPoint *HP_clif_pPetEvolution_pre; @@ -2258,6 +2244,16 @@ struct { struct HPMHookPoint *HP_clif_pNPCBarterPurchase_post; struct HPMHookPoint *HP_clif_pClientVersion_pre; struct HPMHookPoint *HP_clif_pClientVersion_post; + struct HPMHookPoint *HP_clif_pPing_pre; + struct HPMHookPoint *HP_clif_pPing_post; + struct HPMHookPoint *HP_clif_ping_pre; + struct HPMHookPoint *HP_clif_ping_post; + struct HPMHookPoint *HP_clif_pingTimer_pre; + struct HPMHookPoint *HP_clif_pingTimer_post; + struct HPMHookPoint *HP_clif_pingTimerSub_pre; + struct HPMHookPoint *HP_clif_pingTimerSub_post; + struct HPMHookPoint *HP_clif_pResetCooldown_pre; + struct HPMHookPoint *HP_clif_pResetCooldown_post; struct HPMHookPoint *HP_cmdline_init_pre; struct HPMHookPoint *HP_cmdline_init_post; struct HPMHookPoint *HP_cmdline_final_pre; @@ -6042,6 +6038,8 @@ struct { struct HPMHookPoint *HP_sockt_flush_post; struct HPMHookPoint *HP_sockt_flush_fifos_pre; struct HPMHookPoint *HP_sockt_flush_fifos_post; + struct HPMHookPoint *HP_sockt_connect_client_pre; + struct HPMHookPoint *HP_sockt_connect_client_post; struct HPMHookPoint *HP_sockt_set_nonblocking_pre; struct HPMHookPoint *HP_sockt_set_nonblocking_post; struct HPMHookPoint *HP_sockt_set_defaultparse_pre; @@ -6462,6 +6460,24 @@ struct { struct HPMHookPoint *HP_strlib_strline__post; struct HPMHookPoint *HP_strlib_bin2hex__pre; struct HPMHookPoint *HP_strlib_bin2hex__post; + struct HPMHookPoint *HP_stylist_init_pre; + struct HPMHookPoint *HP_stylist_init_post; + struct HPMHookPoint *HP_stylist_final_pre; + struct HPMHookPoint *HP_stylist_final_post; + struct HPMHookPoint *HP_stylist_vector_init_pre; + struct HPMHookPoint *HP_stylist_vector_init_post; + struct HPMHookPoint *HP_stylist_vector_clear_pre; + struct HPMHookPoint *HP_stylist_vector_clear_post; + struct HPMHookPoint *HP_stylist_read_db_libconfig_pre; + struct HPMHookPoint *HP_stylist_read_db_libconfig_post; + struct HPMHookPoint *HP_stylist_read_db_libconfig_sub_pre; + struct HPMHookPoint *HP_stylist_read_db_libconfig_sub_post; + struct HPMHookPoint *HP_stylist_request_style_change_pre; + struct HPMHookPoint *HP_stylist_request_style_change_post; + struct HPMHookPoint *HP_stylist_validate_requirements_pre; + struct HPMHookPoint *HP_stylist_validate_requirements_post; + struct HPMHookPoint *HP_stylist_send_rodexitem_pre; + struct HPMHookPoint *HP_stylist_send_rodexitem_post; struct HPMHookPoint *HP_sv_parse_next_pre; struct HPMHookPoint *HP_sv_parse_next_post; struct HPMHookPoint *HP_sv_parse_pre; @@ -7637,8 +7653,8 @@ struct { int HP_clif_mvp_noitem_post; int HP_clif_changed_dir_pre; int HP_clif_changed_dir_post; - int HP_clif_charnameack_pre; - int HP_clif_charnameack_post; + int HP_clif_blname_ack_pre; + int HP_clif_blname_ack_post; int HP_clif_monster_hp_bar_pre; int HP_clif_monster_hp_bar_post; int HP_clif_hpmeter_pre; @@ -8879,24 +8895,10 @@ struct { int HP_clif_pPrivateAirshipRequest_post; int HP_clif_PrivateAirshipResponse_pre; int HP_clif_PrivateAirshipResponse_post; - int HP_clif_stylist_vector_init_pre; - int HP_clif_stylist_vector_init_post; - int HP_clif_stylist_vector_clear_pre; - int HP_clif_stylist_vector_clear_post; - int HP_clif_stylist_read_db_libconfig_pre; - int HP_clif_stylist_read_db_libconfig_post; - int HP_clif_stylist_read_db_libconfig_sub_pre; - int HP_clif_stylist_read_db_libconfig_sub_post; - int HP_clif_style_change_validate_requirements_pre; - int HP_clif_style_change_validate_requirements_post; - int HP_clif_stylist_send_rodexitem_pre; - int HP_clif_stylist_send_rodexitem_post; int HP_clif_pReqStyleChange_pre; int HP_clif_pReqStyleChange_post; int HP_clif_pReqStyleChange2_pre; int HP_clif_pReqStyleChange2_post; - int HP_clif_cz_req_style_change_sub_pre; - int HP_clif_cz_req_style_change_sub_post; int HP_clif_style_change_response_pre; int HP_clif_style_change_response_post; int HP_clif_pPetEvolution_pre; @@ -8927,6 +8929,16 @@ struct { int HP_clif_pNPCBarterPurchase_post; int HP_clif_pClientVersion_pre; int HP_clif_pClientVersion_post; + int HP_clif_pPing_pre; + int HP_clif_pPing_post; + int HP_clif_ping_pre; + int HP_clif_ping_post; + int HP_clif_pingTimer_pre; + int HP_clif_pingTimer_post; + int HP_clif_pingTimerSub_pre; + int HP_clif_pingTimerSub_post; + int HP_clif_pResetCooldown_pre; + int HP_clif_pResetCooldown_post; int HP_cmdline_init_pre; int HP_cmdline_init_post; int HP_cmdline_final_pre; @@ -12711,6 +12723,8 @@ struct { int HP_sockt_flush_post; int HP_sockt_flush_fifos_pre; int HP_sockt_flush_fifos_post; + int HP_sockt_connect_client_pre; + int HP_sockt_connect_client_post; int HP_sockt_set_nonblocking_pre; int HP_sockt_set_nonblocking_post; int HP_sockt_set_defaultparse_pre; @@ -13131,6 +13145,24 @@ struct { int HP_strlib_strline__post; int HP_strlib_bin2hex__pre; int HP_strlib_bin2hex__post; + int HP_stylist_init_pre; + int HP_stylist_init_post; + int HP_stylist_final_pre; + int HP_stylist_final_post; + int HP_stylist_vector_init_pre; + int HP_stylist_vector_init_post; + int HP_stylist_vector_clear_pre; + int HP_stylist_vector_clear_post; + int HP_stylist_read_db_libconfig_pre; + int HP_stylist_read_db_libconfig_post; + int HP_stylist_read_db_libconfig_sub_pre; + int HP_stylist_read_db_libconfig_sub_post; + int HP_stylist_request_style_change_pre; + int HP_stylist_request_style_change_post; + int HP_stylist_validate_requirements_pre; + int HP_stylist_validate_requirements_post; + int HP_stylist_send_rodexitem_pre; + int HP_stylist_send_rodexitem_post; int HP_sv_parse_next_pre; int HP_sv_parse_next_post; int HP_sv_parse_pre; @@ -13424,6 +13456,7 @@ struct { struct storage_interface storage; struct stringbuf_interface StrBuf; struct strlib_interface strlib; + struct stylist_interface stylist; struct sv_interface sv; struct sysinfo_interface sysinfo; struct thread_interface thread; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index 3c09aba59..8532f9d22 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -508,7 +508,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(clif->mvp_exp, HP_clif_mvp_exp) }, { HP_POP(clif->mvp_noitem, HP_clif_mvp_noitem) }, { HP_POP(clif->changed_dir, HP_clif_changed_dir) }, - { HP_POP(clif->charnameack, HP_clif_charnameack) }, + { HP_POP(clif->blname_ack, HP_clif_blname_ack) }, { HP_POP(clif->monster_hp_bar, HP_clif_monster_hp_bar) }, { HP_POP(clif->hpmeter, HP_clif_hpmeter) }, { HP_POP(clif->hpmeter_single, HP_clif_hpmeter_single) }, @@ -1129,15 +1129,8 @@ struct HookingPointData HookingPoints[] = { { HP_POP(clif->ui_action, HP_clif_ui_action) }, { HP_POP(clif->pPrivateAirshipRequest, HP_clif_pPrivateAirshipRequest) }, { HP_POP(clif->PrivateAirshipResponse, HP_clif_PrivateAirshipResponse) }, - { HP_POP(clif->stylist_vector_init, HP_clif_stylist_vector_init) }, - { HP_POP(clif->stylist_vector_clear, HP_clif_stylist_vector_clear) }, - { HP_POP(clif->stylist_read_db_libconfig, HP_clif_stylist_read_db_libconfig) }, - { HP_POP(clif->stylist_read_db_libconfig_sub, HP_clif_stylist_read_db_libconfig_sub) }, - { HP_POP(clif->style_change_validate_requirements, HP_clif_style_change_validate_requirements) }, - { HP_POP(clif->stylist_send_rodexitem, HP_clif_stylist_send_rodexitem) }, { HP_POP(clif->pReqStyleChange, HP_clif_pReqStyleChange) }, { HP_POP(clif->pReqStyleChange2, HP_clif_pReqStyleChange2) }, - { HP_POP(clif->cz_req_style_change_sub, HP_clif_cz_req_style_change_sub) }, { HP_POP(clif->style_change_response, HP_clif_style_change_response) }, { HP_POP(clif->pPetEvolution, HP_clif_pPetEvolution) }, { HP_POP(clif->petEvolutionResult, HP_clif_petEvolutionResult) }, @@ -1153,6 +1146,11 @@ struct HookingPointData HookingPoints[] = { { HP_POP(clif->pNPCBarterClosed, HP_clif_pNPCBarterClosed) }, { HP_POP(clif->pNPCBarterPurchase, HP_clif_pNPCBarterPurchase) }, { HP_POP(clif->pClientVersion, HP_clif_pClientVersion) }, + { HP_POP(clif->pPing, HP_clif_pPing) }, + { HP_POP(clif->ping, HP_clif_ping) }, + { HP_POP(clif->pingTimer, HP_clif_pingTimer) }, + { HP_POP(clif->pingTimerSub, HP_clif_pingTimerSub) }, + { HP_POP(clif->pResetCooldown, HP_clif_pResetCooldown) }, /* cmdline_interface */ { HP_POP(cmdline->init, HP_cmdline_init) }, { HP_POP(cmdline->final, HP_cmdline_final) }, @@ -3089,6 +3087,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(sockt->session_is_active, HP_sockt_session_is_active) }, { HP_POP(sockt->flush, HP_sockt_flush) }, { HP_POP(sockt->flush_fifos, HP_sockt_flush_fifos) }, + { HP_POP(sockt->connect_client, HP_sockt_connect_client) }, { HP_POP(sockt->set_nonblocking, HP_sockt_set_nonblocking) }, { HP_POP(sockt->set_defaultparse, HP_sockt_set_defaultparse) }, { HP_POP(sockt->host2ip, HP_sockt_host2ip) }, @@ -3304,6 +3303,16 @@ struct HookingPointData HookingPoints[] = { { HP_POP(strlib->safestrnlen_, HP_strlib_safestrnlen_) }, { HP_POP(strlib->strline_, HP_strlib_strline_) }, { HP_POP(strlib->bin2hex_, HP_strlib_bin2hex_) }, +/* stylist_interface */ + { HP_POP(stylist->init, HP_stylist_init) }, + { HP_POP(stylist->final, HP_stylist_final) }, + { HP_POP(stylist->vector_init, HP_stylist_vector_init) }, + { HP_POP(stylist->vector_clear, HP_stylist_vector_clear) }, + { HP_POP(stylist->read_db_libconfig, HP_stylist_read_db_libconfig) }, + { HP_POP(stylist->read_db_libconfig_sub, HP_stylist_read_db_libconfig_sub) }, + { HP_POP(stylist->request_style_change, HP_stylist_request_style_change) }, + { HP_POP(stylist->validate_requirements, HP_stylist_validate_requirements) }, + { HP_POP(stylist->send_rodexitem, HP_stylist_send_rodexitem) }, /* sv_interface */ { HP_POP(sv->parse_next, HP_sv_parse_next) }, { HP_POP(sv->parse, HP_sv_parse) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 8242b9797..e6f8a69f0 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -12619,13 +12619,13 @@ void HP_clif_changed_dir(struct block_list *bl, enum send_target target) { } return; } -void HP_clif_charnameack(int fd, struct block_list *bl) { +void HP_clif_blname_ack(int fd, struct block_list *bl) { int hIndex = 0; - if (HPMHooks.count.HP_clif_charnameack_pre > 0) { + if (HPMHooks.count.HP_clif_blname_ack_pre > 0) { void (*preHookFunc) (int *fd, struct block_list **bl); *HPMforce_return = false; - for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_charnameack_pre; hIndex++) { - preHookFunc = HPMHooks.list.HP_clif_charnameack_pre[hIndex].func; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_blname_ack_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_blname_ack_pre[hIndex].func; preHookFunc(&fd, &bl); } if (*HPMforce_return) { @@ -12634,12 +12634,12 @@ void HP_clif_charnameack(int fd, struct block_list *bl) { } } { - HPMHooks.source.clif.charnameack(fd, bl); + HPMHooks.source.clif.blname_ack(fd, bl); } - if (HPMHooks.count.HP_clif_charnameack_post > 0) { + if (HPMHooks.count.HP_clif_blname_ack_post > 0) { void (*postHookFunc) (int fd, struct block_list *bl); - for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_charnameack_post; hIndex++) { - postHookFunc = HPMHooks.list.HP_clif_charnameack_post[hIndex].func; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_blname_ack_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_blname_ack_post[hIndex].func; postHookFunc(fd, bl); } } @@ -28806,165 +28806,6 @@ void HP_clif_PrivateAirshipResponse(struct map_session_data *sd, uint32 flag) { } return; } -void HP_clif_stylist_vector_init(void) { - int hIndex = 0; - if (HPMHooks.count.HP_clif_stylist_vector_init_pre > 0) { - void (*preHookFunc) (void); - *HPMforce_return = false; - for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_stylist_vector_init_pre; hIndex++) { - preHookFunc = HPMHooks.list.HP_clif_stylist_vector_init_pre[hIndex].func; - preHookFunc(); - } - if (*HPMforce_return) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.clif.stylist_vector_init(); - } - if (HPMHooks.count.HP_clif_stylist_vector_init_post > 0) { - void (*postHookFunc) (void); - for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_stylist_vector_init_post; hIndex++) { - postHookFunc = HPMHooks.list.HP_clif_stylist_vector_init_post[hIndex].func; - postHookFunc(); - } - } - return; -} -void HP_clif_stylist_vector_clear(void) { - int hIndex = 0; - if (HPMHooks.count.HP_clif_stylist_vector_clear_pre > 0) { - void (*preHookFunc) (void); - *HPMforce_return = false; - for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_stylist_vector_clear_pre; hIndex++) { - preHookFunc = HPMHooks.list.HP_clif_stylist_vector_clear_pre[hIndex].func; - preHookFunc(); - } - if (*HPMforce_return) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.clif.stylist_vector_clear(); - } - if (HPMHooks.count.HP_clif_stylist_vector_clear_post > 0) { - void (*postHookFunc) (void); - for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_stylist_vector_clear_post; hIndex++) { - postHookFunc = HPMHooks.list.HP_clif_stylist_vector_clear_post[hIndex].func; - postHookFunc(); - } - } - return; -} -bool HP_clif_stylist_read_db_libconfig(void) { - int hIndex = 0; - bool retVal___ = false; - if (HPMHooks.count.HP_clif_stylist_read_db_libconfig_pre > 0) { - bool (*preHookFunc) (void); - *HPMforce_return = false; - for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_stylist_read_db_libconfig_pre; hIndex++) { - preHookFunc = HPMHooks.list.HP_clif_stylist_read_db_libconfig_pre[hIndex].func; - retVal___ = preHookFunc(); - } - if (*HPMforce_return) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.clif.stylist_read_db_libconfig(); - } - if (HPMHooks.count.HP_clif_stylist_read_db_libconfig_post > 0) { - bool (*postHookFunc) (bool retVal___); - for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_stylist_read_db_libconfig_post; hIndex++) { - postHookFunc = HPMHooks.list.HP_clif_stylist_read_db_libconfig_post[hIndex].func; - retVal___ = postHookFunc(retVal___); - } - } - return retVal___; -} -bool HP_clif_stylist_read_db_libconfig_sub(struct config_setting_t *it, int idx, const char *source) { - int hIndex = 0; - bool retVal___ = false; - if (HPMHooks.count.HP_clif_stylist_read_db_libconfig_sub_pre > 0) { - bool (*preHookFunc) (struct config_setting_t **it, int *idx, const char **source); - *HPMforce_return = false; - for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_stylist_read_db_libconfig_sub_pre; hIndex++) { - preHookFunc = HPMHooks.list.HP_clif_stylist_read_db_libconfig_sub_pre[hIndex].func; - retVal___ = preHookFunc(&it, &idx, &source); - } - if (*HPMforce_return) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.clif.stylist_read_db_libconfig_sub(it, idx, source); - } - if (HPMHooks.count.HP_clif_stylist_read_db_libconfig_sub_post > 0) { - bool (*postHookFunc) (bool retVal___, struct config_setting_t *it, int idx, const char *source); - for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_stylist_read_db_libconfig_sub_post; hIndex++) { - postHookFunc = HPMHooks.list.HP_clif_stylist_read_db_libconfig_sub_post[hIndex].func; - retVal___ = postHookFunc(retVal___, it, idx, source); - } - } - return retVal___; -} -bool HP_clif_style_change_validate_requirements(struct map_session_data *sd, int type, int16 idx) { - int hIndex = 0; - bool retVal___ = false; - if (HPMHooks.count.HP_clif_style_change_validate_requirements_pre > 0) { - bool (*preHookFunc) (struct map_session_data **sd, int *type, int16 *idx); - *HPMforce_return = false; - for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_style_change_validate_requirements_pre; hIndex++) { - preHookFunc = HPMHooks.list.HP_clif_style_change_validate_requirements_pre[hIndex].func; - retVal___ = preHookFunc(&sd, &type, &idx); - } - if (*HPMforce_return) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.clif.style_change_validate_requirements(sd, type, idx); - } - if (HPMHooks.count.HP_clif_style_change_validate_requirements_post > 0) { - bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, int type, int16 idx); - for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_style_change_validate_requirements_post; hIndex++) { - postHookFunc = HPMHooks.list.HP_clif_style_change_validate_requirements_post[hIndex].func; - retVal___ = postHookFunc(retVal___, sd, type, idx); - } - } - return retVal___; -} -void HP_clif_stylist_send_rodexitem(struct map_session_data *sd, int itemid) { - int hIndex = 0; - if (HPMHooks.count.HP_clif_stylist_send_rodexitem_pre > 0) { - void (*preHookFunc) (struct map_session_data **sd, int *itemid); - *HPMforce_return = false; - for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_stylist_send_rodexitem_pre; hIndex++) { - preHookFunc = HPMHooks.list.HP_clif_stylist_send_rodexitem_pre[hIndex].func; - preHookFunc(&sd, &itemid); - } - if (*HPMforce_return) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.clif.stylist_send_rodexitem(sd, itemid); - } - if (HPMHooks.count.HP_clif_stylist_send_rodexitem_post > 0) { - void (*postHookFunc) (struct map_session_data *sd, int itemid); - for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_stylist_send_rodexitem_post; hIndex++) { - postHookFunc = HPMHooks.list.HP_clif_stylist_send_rodexitem_post[hIndex].func; - postHookFunc(sd, itemid); - } - } - return; -} void HP_clif_pReqStyleChange(int fd, struct map_session_data *sd) { int hIndex = 0; if (HPMHooks.count.HP_clif_pReqStyleChange_pre > 0) { @@ -29017,32 +28858,6 @@ void HP_clif_pReqStyleChange2(int fd, struct map_session_data *sd) { } return; } -void HP_clif_cz_req_style_change_sub(struct map_session_data *sd, int type, int16 idx, bool isitem) { - int hIndex = 0; - if (HPMHooks.count.HP_clif_cz_req_style_change_sub_pre > 0) { - void (*preHookFunc) (struct map_session_data **sd, int *type, int16 *idx, bool *isitem); - *HPMforce_return = false; - for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_cz_req_style_change_sub_pre; hIndex++) { - preHookFunc = HPMHooks.list.HP_clif_cz_req_style_change_sub_pre[hIndex].func; - preHookFunc(&sd, &type, &idx, &isitem); - } - if (*HPMforce_return) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.clif.cz_req_style_change_sub(sd, type, idx, isitem); - } - if (HPMHooks.count.HP_clif_cz_req_style_change_sub_post > 0) { - void (*postHookFunc) (struct map_session_data *sd, int type, int16 idx, bool isitem); - for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_cz_req_style_change_sub_post; hIndex++) { - postHookFunc = HPMHooks.list.HP_clif_cz_req_style_change_sub_post[hIndex].func; - postHookFunc(sd, type, idx, isitem); - } - } - return; -} void HP_clif_style_change_response(struct map_session_data *sd, enum stylist_shop flag) { int hIndex = 0; if (HPMHooks.count.HP_clif_style_change_response_pre > 0) { @@ -29434,6 +29249,144 @@ void HP_clif_pClientVersion(int fd, struct map_session_data *sd) { } return; } +void HP_clif_pPing(int fd, struct map_session_data *sd) { + int hIndex = 0; + if (HPMHooks.count.HP_clif_pPing_pre > 0) { + void (*preHookFunc) (int *fd, struct map_session_data **sd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_pPing_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_pPing_pre[hIndex].func; + preHookFunc(&fd, &sd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.clif.pPing(fd, sd); + } + if (HPMHooks.count.HP_clif_pPing_post > 0) { + void (*postHookFunc) (int fd, struct map_session_data *sd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_pPing_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_pPing_post[hIndex].func; + postHookFunc(fd, sd); + } + } + return; +} +void HP_clif_ping(struct map_session_data *sd) { + int hIndex = 0; + if (HPMHooks.count.HP_clif_ping_pre > 0) { + void (*preHookFunc) (struct map_session_data **sd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_ping_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_ping_pre[hIndex].func; + preHookFunc(&sd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.clif.ping(sd); + } + if (HPMHooks.count.HP_clif_ping_post > 0) { + void (*postHookFunc) (struct map_session_data *sd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_ping_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_ping_post[hIndex].func; + postHookFunc(sd); + } + } + return; +} +int HP_clif_pingTimer(int tid, int64 tick, int id, intptr_t data) { + int hIndex = 0; + int retVal___ = 0; + if (HPMHooks.count.HP_clif_pingTimer_pre > 0) { + int (*preHookFunc) (int *tid, int64 *tick, int *id, intptr_t *data); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_pingTimer_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_pingTimer_pre[hIndex].func; + retVal___ = preHookFunc(&tid, &tick, &id, &data); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.clif.pingTimer(tid, tick, id, data); + } + if (HPMHooks.count.HP_clif_pingTimer_post > 0) { + int (*postHookFunc) (int retVal___, int tid, int64 tick, int id, intptr_t data); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_pingTimer_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_pingTimer_post[hIndex].func; + retVal___ = postHookFunc(retVal___, tid, tick, id, data); + } + } + return retVal___; +} +int HP_clif_pingTimerSub(struct map_session_data *sd, va_list ap) { + int hIndex = 0; + int retVal___ = 0; + if (HPMHooks.count.HP_clif_pingTimerSub_pre > 0) { + int (*preHookFunc) (struct map_session_data **sd, va_list ap); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_pingTimerSub_pre; hIndex++) { + va_list ap___copy; va_copy(ap___copy, ap); + preHookFunc = HPMHooks.list.HP_clif_pingTimerSub_pre[hIndex].func; + retVal___ = preHookFunc(&sd, ap___copy); + va_end(ap___copy); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + va_list ap___copy; va_copy(ap___copy, ap); + retVal___ = HPMHooks.source.clif.pingTimerSub(sd, ap___copy); + va_end(ap___copy); + } + if (HPMHooks.count.HP_clif_pingTimerSub_post > 0) { + int (*postHookFunc) (int retVal___, struct map_session_data *sd, va_list ap); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_pingTimerSub_post; hIndex++) { + va_list ap___copy; va_copy(ap___copy, ap); + postHookFunc = HPMHooks.list.HP_clif_pingTimerSub_post[hIndex].func; + retVal___ = postHookFunc(retVal___, sd, ap___copy); + va_end(ap___copy); + } + } + return retVal___; +} +void HP_clif_pResetCooldown(int fd, struct map_session_data *sd) { + int hIndex = 0; + if (HPMHooks.count.HP_clif_pResetCooldown_pre > 0) { + void (*preHookFunc) (int *fd, struct map_session_data **sd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_pResetCooldown_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_pResetCooldown_pre[hIndex].func; + preHookFunc(&fd, &sd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.clif.pResetCooldown(fd, sd); + } + if (HPMHooks.count.HP_clif_pResetCooldown_post > 0) { + void (*postHookFunc) (int fd, struct map_session_data *sd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_pResetCooldown_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_pResetCooldown_post[hIndex].func; + postHookFunc(fd, sd); + } + } + return; +} /* cmdline_interface */ void HP_cmdline_init(void) { int hIndex = 0; @@ -80816,6 +80769,33 @@ void HP_sockt_flush_fifos(void) { } return; } +int HP_sockt_connect_client(int listen_fd) { + int hIndex = 0; + int retVal___ = 0; + if (HPMHooks.count.HP_sockt_connect_client_pre > 0) { + int (*preHookFunc) (int *listen_fd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_connect_client_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_sockt_connect_client_pre[hIndex].func; + retVal___ = preHookFunc(&listen_fd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.sockt.connect_client(listen_fd); + } + if (HPMHooks.count.HP_sockt_connect_client_post > 0) { + int (*postHookFunc) (int retVal___, int listen_fd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_connect_client_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_sockt_connect_client_post[hIndex].func; + retVal___ = postHookFunc(retVal___, listen_fd); + } + } + return retVal___; +} void HP_sockt_set_nonblocking(int fd, unsigned long yes) { int hIndex = 0; if (HPMHooks.count.HP_sockt_set_nonblocking_pre > 0) { @@ -86488,6 +86468,244 @@ bool HP_strlib_bin2hex_(char *output, const unsigned char *input, size_t count) } return retVal___; } +/* stylist_interface */ +void HP_stylist_init(bool minimal) { + int hIndex = 0; + if (HPMHooks.count.HP_stylist_init_pre > 0) { + void (*preHookFunc) (bool *minimal); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_stylist_init_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_stylist_init_pre[hIndex].func; + preHookFunc(&minimal); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.stylist.init(minimal); + } + if (HPMHooks.count.HP_stylist_init_post > 0) { + void (*postHookFunc) (bool minimal); + for (hIndex = 0; hIndex < HPMHooks.count.HP_stylist_init_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_stylist_init_post[hIndex].func; + postHookFunc(minimal); + } + } + return; +} +void HP_stylist_final(void) { + int hIndex = 0; + if (HPMHooks.count.HP_stylist_final_pre > 0) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_stylist_final_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_stylist_final_pre[hIndex].func; + preHookFunc(); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.stylist.final(); + } + if (HPMHooks.count.HP_stylist_final_post > 0) { + void (*postHookFunc) (void); + for (hIndex = 0; hIndex < HPMHooks.count.HP_stylist_final_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_stylist_final_post[hIndex].func; + postHookFunc(); + } + } + return; +} +void HP_stylist_vector_init(void) { + int hIndex = 0; + if (HPMHooks.count.HP_stylist_vector_init_pre > 0) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_stylist_vector_init_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_stylist_vector_init_pre[hIndex].func; + preHookFunc(); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.stylist.vector_init(); + } + if (HPMHooks.count.HP_stylist_vector_init_post > 0) { + void (*postHookFunc) (void); + for (hIndex = 0; hIndex < HPMHooks.count.HP_stylist_vector_init_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_stylist_vector_init_post[hIndex].func; + postHookFunc(); + } + } + return; +} +void HP_stylist_vector_clear(void) { + int hIndex = 0; + if (HPMHooks.count.HP_stylist_vector_clear_pre > 0) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_stylist_vector_clear_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_stylist_vector_clear_pre[hIndex].func; + preHookFunc(); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.stylist.vector_clear(); + } + if (HPMHooks.count.HP_stylist_vector_clear_post > 0) { + void (*postHookFunc) (void); + for (hIndex = 0; hIndex < HPMHooks.count.HP_stylist_vector_clear_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_stylist_vector_clear_post[hIndex].func; + postHookFunc(); + } + } + return; +} +bool HP_stylist_read_db_libconfig(void) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_stylist_read_db_libconfig_pre > 0) { + bool (*preHookFunc) (void); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_stylist_read_db_libconfig_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_stylist_read_db_libconfig_pre[hIndex].func; + retVal___ = preHookFunc(); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.stylist.read_db_libconfig(); + } + if (HPMHooks.count.HP_stylist_read_db_libconfig_post > 0) { + bool (*postHookFunc) (bool retVal___); + for (hIndex = 0; hIndex < HPMHooks.count.HP_stylist_read_db_libconfig_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_stylist_read_db_libconfig_post[hIndex].func; + retVal___ = postHookFunc(retVal___); + } + } + return retVal___; +} +bool HP_stylist_read_db_libconfig_sub(struct config_setting_t *it, int idx, const char *source) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_stylist_read_db_libconfig_sub_pre > 0) { + bool (*preHookFunc) (struct config_setting_t **it, int *idx, const char **source); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_stylist_read_db_libconfig_sub_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_stylist_read_db_libconfig_sub_pre[hIndex].func; + retVal___ = preHookFunc(&it, &idx, &source); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.stylist.read_db_libconfig_sub(it, idx, source); + } + if (HPMHooks.count.HP_stylist_read_db_libconfig_sub_post > 0) { + bool (*postHookFunc) (bool retVal___, struct config_setting_t *it, int idx, const char *source); + for (hIndex = 0; hIndex < HPMHooks.count.HP_stylist_read_db_libconfig_sub_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_stylist_read_db_libconfig_sub_post[hIndex].func; + retVal___ = postHookFunc(retVal___, it, idx, source); + } + } + return retVal___; +} +void HP_stylist_request_style_change(struct map_session_data *sd, int type, int16 idx, bool isitem) { + int hIndex = 0; + if (HPMHooks.count.HP_stylist_request_style_change_pre > 0) { + void (*preHookFunc) (struct map_session_data **sd, int *type, int16 *idx, bool *isitem); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_stylist_request_style_change_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_stylist_request_style_change_pre[hIndex].func; + preHookFunc(&sd, &type, &idx, &isitem); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.stylist.request_style_change(sd, type, idx, isitem); + } + if (HPMHooks.count.HP_stylist_request_style_change_post > 0) { + void (*postHookFunc) (struct map_session_data *sd, int type, int16 idx, bool isitem); + for (hIndex = 0; hIndex < HPMHooks.count.HP_stylist_request_style_change_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_stylist_request_style_change_post[hIndex].func; + postHookFunc(sd, type, idx, isitem); + } + } + return; +} +bool HP_stylist_validate_requirements(struct map_session_data *sd, int type, int16 idx) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_stylist_validate_requirements_pre > 0) { + bool (*preHookFunc) (struct map_session_data **sd, int *type, int16 *idx); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_stylist_validate_requirements_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_stylist_validate_requirements_pre[hIndex].func; + retVal___ = preHookFunc(&sd, &type, &idx); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.stylist.validate_requirements(sd, type, idx); + } + if (HPMHooks.count.HP_stylist_validate_requirements_post > 0) { + bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, int type, int16 idx); + for (hIndex = 0; hIndex < HPMHooks.count.HP_stylist_validate_requirements_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_stylist_validate_requirements_post[hIndex].func; + retVal___ = postHookFunc(retVal___, sd, type, idx); + } + } + return retVal___; +} +void HP_stylist_send_rodexitem(struct map_session_data *sd, int itemid) { + int hIndex = 0; + if (HPMHooks.count.HP_stylist_send_rodexitem_pre > 0) { + void (*preHookFunc) (struct map_session_data **sd, int *itemid); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_stylist_send_rodexitem_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_stylist_send_rodexitem_pre[hIndex].func; + preHookFunc(&sd, &itemid); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.stylist.send_rodexitem(sd, itemid); + } + if (HPMHooks.count.HP_stylist_send_rodexitem_post > 0) { + void (*postHookFunc) (struct map_session_data *sd, int itemid); + for (hIndex = 0; hIndex < HPMHooks.count.HP_stylist_send_rodexitem_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_stylist_send_rodexitem_post[hIndex].func; + postHookFunc(sd, itemid); + } + } + return; +} /* sv_interface */ int HP_sv_parse_next(struct s_svstate *svstate) { int hIndex = 0; diff --git a/src/plugins/HPMHooking/HPMHooking_map.sources.inc b/src/plugins/HPMHooking/HPMHooking_map.sources.inc index 7a3c5b9a7..59ee43ab7 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.sources.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.sources.inc @@ -85,6 +85,7 @@ HPMHooks.source.status = *status; HPMHooks.source.storage = *storage; HPMHooks.source.StrBuf = *StrBuf; HPMHooks.source.strlib = *strlib; +HPMHooks.source.stylist = *stylist; HPMHooks.source.sv = *sv; HPMHooks.source.sysinfo = *sysinfo; HPMHooks.source.thread = *thread; diff --git a/src/plugins/db2sql.c b/src/plugins/db2sql.c index 2ece501b2..159d4e2a6 100644 --- a/src/plugins/db2sql.c +++ b/src/plugins/db2sql.c @@ -956,6 +956,7 @@ bool mobskilldb2sql_sub(struct config_setting_t *it, int n, int mob_id) struct mob_db *md = mob->db(mob_id); char valname[15]; const char *name = config_setting_name(it); + char e_name[NAME_LENGTH*2+1]; nullpo_retr(false, it); Assert_retr(false, mob_id <= 0 || md != mob->dummy); @@ -966,7 +967,8 @@ bool mobskilldb2sql_sub(struct config_setting_t *it, int n, int mob_id) StrBuf->Printf(&buf, "%d,", mob_id); // Info - StrBuf->Printf(&buf, "'%s@%s',", md->name, name); + SQL->EscapeString(NULL, e_name, md->name); + StrBuf->Printf(&buf, "'%s@%s',", e_name, name); if (mob->lookup_const(it, "SkillState", &i32) && (i32 < MSS_ANY || i32 > MSS_ANYTARGET)) { ShowWarning("mob_skill_db_libconfig_sub_skill: Invalid skill state %d for skill '%s' in monster %d, defaulting to MSS_ANY.\n", i32, name, mob_id); diff --git a/src/plugins/sample.c b/src/plugins/sample.c index b37f7c4f7..7ad6794b3 100644 --- a/src/plugins/sample.c +++ b/src/plugins/sample.c @@ -23,6 +23,7 @@ #include "common/hercules.h" /* Should always be the first Hercules file included! (if you don't make it first, you won't be able to use interfaces) */ #include "common/memmgr.h" #include "common/mmo.h" +#include "common/random.h" #include "common/socket.h" #include "common/strlib.h" #include "map/clif.h" @@ -79,13 +80,13 @@ void sample_packet0f3(int fd) { data->lastMSGPosition.map = sd->status.last_point.map; data->lastMSGPosition.x = sd->status.last_point.x; data->lastMSGPosition.y = sd->status.last_point.y; - data->someNumber = rand()%777; + data->someNumber = rnd()%777; ShowInfo("Created Appended sockt->session[] data, %d %d %d %u\n",data->lastMSGPosition.map,data->lastMSGPosition.x,data->lastMSGPosition.y,data->someNumber); addToSession(sockt->session[fd],data,0,true); } else { ShowInfo("Existent Appended sockt->session[] data, %d %d %d %u\n",data->lastMSGPosition.map,data->lastMSGPosition.x,data->lastMSGPosition.y,data->someNumber); - if( rand()%4 == 2 ) { + if (rnd()%4 == 2) { ShowInfo("Removing Appended sockt->session[] data\n"); removeFromSession(sockt->session[fd],0); } @@ -98,13 +99,13 @@ void sample_packet0f3(int fd) { data->lastMSGPosition.map = sd->status.last_point.map; data->lastMSGPosition.x = sd->status.last_point.x; data->lastMSGPosition.y = sd->status.last_point.y; - data->someNumber = rand()%777; + data->someNumber = rnd()%777; ShowInfo("Created Appended map_session_data data, %d %d %d %u\n",data->lastMSGPosition.map,data->lastMSGPosition.x,data->lastMSGPosition.y,data->someNumber); addToMSD(sd,data,0,true); } else { ShowInfo("Existent Appended map_session_data data, %d %d %d %u\n",data->lastMSGPosition.map,data->lastMSGPosition.x,data->lastMSGPosition.y,data->someNumber); - if( rand()%4 == 2 ) { + if (rnd()%4 == 2) { ShowInfo("Removing Appended map_session_data data\n"); removeFromMSD(sd,0); } |