diff options
Diffstat (limited to 'src/map')
35 files changed, 1304 insertions, 420 deletions
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 */ |