diff options
Diffstat (limited to 'src')
29 files changed, 1299 insertions, 178 deletions
diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h index 31bce72b2..f5875fe11 100644 --- a/src/common/HPMDataCheck.h +++ b/src/common/HPMDataCheck.h @@ -557,6 +557,7 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { { "mapflag_skill_adjust", sizeof(struct mapflag_skill_adjust), SERVER_TYPE_MAP }, { "mapit_interface", sizeof(struct mapit_interface), SERVER_TYPE_MAP }, { "questinfo", sizeof(struct questinfo), SERVER_TYPE_MAP }, + { "questinfo_itemreq", sizeof(struct questinfo_itemreq), SERVER_TYPE_MAP }, { "questinfo_qreq", sizeof(struct questinfo_qreq), SERVER_TYPE_MAP }, { "spawn_data", sizeof(struct spawn_data), SERVER_TYPE_MAP }, #else @@ -606,6 +607,7 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { { "NORMALITEM_INFO", sizeof(struct NORMALITEM_INFO), SERVER_TYPE_MAP }, { "PACKET_CZ_ADD_ITEM_TO_MAIL", sizeof(struct PACKET_CZ_ADD_ITEM_TO_MAIL), SERVER_TYPE_MAP }, { "PACKET_CZ_CHECKNAME", sizeof(struct PACKET_CZ_CHECKNAME), SERVER_TYPE_MAP }, + { "PACKET_CZ_MEMORIALDUNGEON_COMMAND", sizeof(struct PACKET_CZ_MEMORIALDUNGEON_COMMAND), SERVER_TYPE_MAP }, { "PACKET_CZ_OPEN_UI", sizeof(struct PACKET_CZ_OPEN_UI), SERVER_TYPE_MAP }, { "PACKET_CZ_PC_BUY_CASH_POINT_ITEM", sizeof(struct PACKET_CZ_PC_BUY_CASH_POINT_ITEM), SERVER_TYPE_MAP }, { "PACKET_CZ_PC_BUY_CASH_POINT_ITEM_sub", sizeof(struct PACKET_CZ_PC_BUY_CASH_POINT_ITEM_sub), SERVER_TYPE_MAP }, @@ -718,7 +720,11 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { { "PACKET_ZC_WARPLIST", sizeof(struct PACKET_ZC_WARPLIST), SERVER_TYPE_MAP }, { "PACKET_ZC_WARPLIST_sub", sizeof(struct PACKET_ZC_WARPLIST_sub), SERVER_TYPE_MAP }, { "PACKET_ZC_WRITE_MAIL_RESULT", sizeof(struct PACKET_ZC_WRITE_MAIL_RESULT), SERVER_TYPE_MAP }, + { "ZC_INVENTORY_END", sizeof(struct ZC_INVENTORY_END), SERVER_TYPE_MAP }, + { "ZC_INVENTORY_START", sizeof(struct ZC_INVENTORY_START), SERVER_TYPE_MAP }, { "ZC_PROGRESS_ACTOR", sizeof(struct ZC_PROGRESS_ACTOR), SERVER_TYPE_MAP }, + { "ZC_STORE_ITEMLIST_EQUIP", sizeof(struct ZC_STORE_ITEMLIST_EQUIP), SERVER_TYPE_MAP }, + { "ZC_STORE_ITEMLIST_NORMAL", sizeof(struct ZC_STORE_ITEMLIST_NORMAL), SERVER_TYPE_MAP }, { "ach_list_info", sizeof(struct ach_list_info), SERVER_TYPE_MAP }, { "mail_item", sizeof(struct mail_item), SERVER_TYPE_MAP }, { "maillistinfo", sizeof(struct maillistinfo), SERVER_TYPE_MAP }, @@ -789,8 +795,6 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { { "packet_status_change", sizeof(struct packet_status_change), SERVER_TYPE_MAP }, { "packet_status_change2", sizeof(struct packet_status_change2), SERVER_TYPE_MAP }, { "packet_status_change_end", sizeof(struct packet_status_change_end), SERVER_TYPE_MAP }, - { "packet_storelist_equip", sizeof(struct packet_storelist_equip), SERVER_TYPE_MAP }, - { "packet_storelist_normal", sizeof(struct packet_storelist_normal), SERVER_TYPE_MAP }, { "packet_unequipitem_ack", sizeof(struct packet_unequipitem_ack), SERVER_TYPE_MAP }, { "packet_unit_walking", sizeof(struct packet_unit_walking), SERVER_TYPE_MAP }, { "packet_viewequip_ack", sizeof(struct packet_viewequip_ack), SERVER_TYPE_MAP }, diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 6522f3013..2538f797c 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -4297,7 +4297,7 @@ ACMD(repairall) if (count > 0) { clif->misceffect(&sd->bl, 3); - clif->equiplist(sd); + clif->equipList(sd); clif->message(fd, msg_fd(fd,107)); // All items have been repaired. } else { clif->message(fd, msg_fd(fd,108)); // No item need to be repaired. diff --git a/src/map/clif.c b/src/map/clif.c index 4e48d7886..76625f0ba 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -86,8 +86,8 @@ static struct s_packet_db packet_db[MAX_PACKET_DB + 1]; /* re-usable */ static struct packet_itemlist_normal itemlist_normal; static struct packet_itemlist_equip itemlist_equip; -static struct packet_storelist_normal storelist_normal; -static struct packet_storelist_equip storelist_equip; +static struct ZC_STORE_ITEMLIST_NORMAL storelist_normal; +static struct ZC_STORE_ITEMLIST_EQUIP storelist_equip; static struct packet_viewequip_ack viewequip_list; #if PACKETVER >= 20131223 static struct packet_npc_market_result_ack npcmarket_result; @@ -2641,7 +2641,7 @@ static void clif_item_movefailed(struct map_session_data *sd, int n) WFIFOHEAD(fd, len); struct PACKET_ZC_INVENTORY_MOVE_FAILED *p = WFIFOP(fd, 0); p->packetType = 0xaa7; - p->index = n; + p->index = n + 2; p->unknown = 1; WFIFOSET(fd, len); #else @@ -2787,7 +2787,18 @@ static void clif_item_normal(short idx, struct NORMALITEM_INFO *p, struct item * #endif } -static void clif_inventorylist(struct map_session_data *sd) +static void clif_inventoryList(struct map_session_data *sd) +{ +#if PACKETVER_RE_NUM >= 20180912 || PACKETVER_ZERO_NUM >= 20180919 + clif->inventoryStart(sd, INVTYPE_INVENTORY, ""); +#endif + clif->inventoryItems(sd, INVTYPE_INVENTORY); +#if PACKETVER_RE_NUM >= 20180912 || PACKETVER_ZERO_NUM >= 20180919 + clif->inventoryEnd(sd, INVTYPE_INVENTORY); +#endif +} + +static void clif_inventoryItems(struct map_session_data *sd, enum inventory_type type) { int i, normal = 0, equip = 0; @@ -2802,9 +2813,12 @@ static void clif_inventorylist(struct map_session_data *sd) clif->item_normal(i+2,&itemlist_normal.list[normal++],&sd->status.inventory[i],sd->inventory_data[i]); } - if( normal ) { - itemlist_normal.PacketType = inventorylistnormalType; - itemlist_normal.PacketLength = 4 + (sizeof(struct NORMALITEM_INFO) * normal); + if (normal) { + itemlist_normal.PacketType = inventorylistnormalType; + itemlist_normal.PacketLength = (sizeof(itemlist_normal) - sizeof(itemlist_normal.list)) + (sizeof(struct NORMALITEM_INFO) * normal); +#if PACKETVER_RE_NUM >= 20180912 || PACKETVER_ZERO_NUM >= 20180919 + itemlist_normal.invType = type; +#endif clif->send(&itemlist_normal, itemlist_normal.PacketLength, &sd->bl, SELF); } @@ -2814,7 +2828,10 @@ static void clif_inventorylist(struct map_session_data *sd) if( equip ) { itemlist_equip.PacketType = inventorylistequipType; - itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + itemlist_equip.PacketLength = (sizeof(itemlist_equip) - sizeof(itemlist_equip.list)) + (sizeof(struct EQUIPITEM_INFO) * equip); +#if PACKETVER_RE_NUM >= 20180912 || PACKETVER_ZERO_NUM >= 20180919 + itemlist_equip.invType = type; +#endif clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); } @@ -2830,8 +2847,20 @@ static void clif_inventorylist(struct map_session_data *sd) #endif } +static void clif_equipList(struct map_session_data *sd) +{ +#if PACKETVER_RE_NUM >= 20180912 || PACKETVER_ZERO_NUM >= 20180919 + clif->inventoryStart(sd, INVTYPE_INVENTORY, ""); + clif->inventoryItems(sd, INVTYPE_INVENTORY); + clif->inventoryEnd(sd, INVTYPE_INVENTORY); +#else + // [4144] for old packet version it send only equipment. this is bug? + clif->equipItems(sd, INVTYPE_INVENTORY); +#endif +} + //Required when items break/get-repaired. Only sends equippable item list. -static void clif_equiplist(struct map_session_data *sd) +static void clif_equipItems(struct map_session_data *sd, enum inventory_type type) { int i, equip = 0; @@ -2844,9 +2873,12 @@ static void clif_equiplist(struct map_session_data *sd) clif->item_equip(i+2,&itemlist_equip.list[equip++],&sd->status.inventory[i],sd->inventory_data[i],pc->equippoint(sd,i)); } - if( equip ) { - itemlist_equip.PacketType = inventorylistequipType; - itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + if (equip) { + itemlist_equip.PacketType = inventorylistequipType; + itemlist_equip.PacketLength = (sizeof(itemlist_equip) - sizeof(itemlist_equip.list)) + (sizeof(struct EQUIPITEM_INFO) * equip); +#if PACKETVER_RE_NUM >= 20180912 || PACKETVER_ZERO_NUM >= 20180919 + itemlist_equip.invType = type; +#endif clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); } @@ -2863,13 +2895,74 @@ static void clif_equiplist(struct map_session_data *sd) #endif } -static void clif_storagelist(struct map_session_data *sd, struct item *items, int items_length) +static void clif_storageList(struct map_session_data *sd, struct item *items, int items_length) { - int i = 0; - struct item_data *id; + nullpo_retv(sd); + + clif->inventoryStart(sd, INVTYPE_STORAGE, "Storage"); + if (sd->storage.aggregate > 0) + clif->storageItems(sd, INVTYPE_STORAGE, items, items_length); + clif->inventoryEnd(sd, INVTYPE_STORAGE); +} + +static void clif_guildStorageList(struct map_session_data *sd, struct item *items, int items_length) +{ + clif->inventoryStart(sd, INVTYPE_GUILD_STORAGE, "Guild storage"); + clif->storageItems(sd, INVTYPE_GUILD_STORAGE, items, items_length); + clif->inventoryEnd(sd, INVTYPE_GUILD_STORAGE); +} + +static void clif_inventoryStart(struct map_session_data *sd, enum inventory_type type, const char *name) +{ +#if PACKETVER_RE_NUM >= 20180829 || PACKETVER_ZERO_NUM >= 20180919 + nullpo_retv(sd); + nullpo_retv(name); + + char buf[sizeof(struct ZC_INVENTORY_START) + 24]; + memset(buf, 0, sizeof(buf)); + struct ZC_INVENTORY_START *p = (struct ZC_INVENTORY_START *)buf; + p->packetType = 0xb08; +#if PACKETVER_RE_NUM >= 20180912 || PACKETVER_ZERO_NUM >= 20180919 + p->invType = type; +#endif +#if PACKETVER_RE_NUM >= 20180919 || PACKETVER_ZERO_NUM >= 20180919 + int strLen = (int)safestrnlen(name, 24); + if (strLen > 24) + strLen = 24; + const int len = sizeof(struct ZC_INVENTORY_START) + strLen; + p->packetLength = len; + safestrncpy(p->name, name, strLen); +#else + const int len = sizeof(struct ZC_INVENTORY_START); + safestrncpy(p->name, name, NAME_LENGTH); +#endif + clif->send(p, len, &sd->bl, SELF); +#endif +} +static void clif_inventoryEnd(struct map_session_data *sd, enum inventory_type type) +{ +#if PACKETVER_RE_NUM >= 20180829 || PACKETVER_ZERO_NUM >= 20180919 + nullpo_retv(sd); + + struct ZC_INVENTORY_END p; + p.packetType = 0xb0b; +#if PACKETVER_RE_NUM >= 20180912 || PACKETVER_ZERO_NUM >= 20180919 + p.invType = type; +#endif + p.flag = 0; + clif->send(&p, sizeof(p), &sd->bl, SELF); +#endif +} + +static void clif_storageItems(struct map_session_data *sd, enum inventory_type type, struct item *items, int items_length) +{ nullpo_retv(sd); nullpo_retv(items); + + int i = 0; + struct item_data *id; + do { int normal = 0, equip = 0, k = 0; @@ -2887,10 +2980,13 @@ static void clif_storagelist(struct map_session_data *sd, struct item *items, in } if( normal ) { - storelist_normal.PacketType = storagelistnormalType; + storelist_normal.PacketType = storageListNormalType; storelist_normal.PacketLength = ( sizeof( storelist_normal ) - sizeof( storelist_normal.list ) ) + (sizeof(struct NORMALITEM_INFO) * normal); -#if PACKETVER >= 20120925 +#if PACKETVER_RE_NUM >= 20180912 || PACKETVER_ZERO_NUM >= 20180919 + storelist_normal.invType = type; +#endif +#if PACKETVER >= 20120925 && PACKETVER_RE_NUM < 20180829 && PACKETVER_ZERO_NUM < 20180919 safestrncpy(storelist_normal.name, "Storage", NAME_LENGTH); #endif @@ -2898,10 +2994,13 @@ static void clif_storagelist(struct map_session_data *sd, struct item *items, in } if( equip ) { - storelist_equip.PacketType = storagelistequipType; + storelist_equip.PacketType = storageListEquipType; storelist_equip.PacketLength = ( sizeof( storelist_equip ) - sizeof( storelist_equip.list ) ) + (sizeof(struct EQUIPITEM_INFO) * equip); -#if PACKETVER >= 20120925 +#if PACKETVER_RE_NUM >= 20180912 || PACKETVER_ZERO_NUM >= 20180919 + storelist_equip.invType = type; +#endif +#if PACKETVER >= 20120925 && PACKETVER_RE_NUM < 20180829 && PACKETVER_ZERO_NUM < 20180919 safestrncpy(storelist_equip.name, "Storage", NAME_LENGTH); #endif @@ -2912,7 +3011,18 @@ static void clif_storagelist(struct map_session_data *sd, struct item *items, in } -static void clif_cartlist(struct map_session_data *sd) +static void clif_cartList(struct map_session_data *sd) +{ +#if PACKETVER_RE_NUM >= 20180912 || PACKETVER_ZERO_NUM >= 20180919 + clif->inventoryStart(sd, INVTYPE_CART, ""); +#endif + clif->cartItems(sd, INVTYPE_CART); +#if PACKETVER_RE_NUM >= 20180912 || PACKETVER_ZERO_NUM >= 20180919 + clif->inventoryEnd(sd, INVTYPE_CART); +#endif +} + +static void clif_cartItems(struct map_session_data *sd, enum inventory_type type) { int i, normal = 0, equip = 0; struct item_data *id; @@ -2930,16 +3040,22 @@ static void clif_cartlist(struct map_session_data *sd) clif->item_normal(i+2,&itemlist_normal.list[normal++],&sd->status.cart[i],id); } - if( normal ) { - itemlist_normal.PacketType = cartlistnormalType; - itemlist_normal.PacketLength = 4 + (sizeof(struct NORMALITEM_INFO) * normal); + if (normal) { + itemlist_normal.PacketType = cartlistnormalType; + itemlist_normal.PacketLength = (sizeof(itemlist_normal) - sizeof(itemlist_normal.list)) + (sizeof(struct NORMALITEM_INFO) * normal); +#if PACKETVER_RE_NUM >= 20180912 || PACKETVER_ZERO_NUM >= 20180919 + itemlist_normal.invType = type; +#endif clif->send(&itemlist_normal, itemlist_normal.PacketLength, &sd->bl, SELF); } - if( equip ) { - itemlist_equip.PacketType = cartlistequipType; - itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + if (equip) { + itemlist_equip.PacketType = cartlistequipType; + itemlist_equip.PacketLength = (sizeof(itemlist_equip) - sizeof(itemlist_equip.list)) + (sizeof(struct EQUIPITEM_INFO) * equip); +#if PACKETVER_RE_NUM >= 20180912 || PACKETVER_ZERO_NUM >= 20180919 + itemlist_equip.invType = type; +#endif clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); } @@ -7571,22 +7687,16 @@ static void clif_mvp_item(struct map_session_data *sd, int nameid) /// 010b <exp>.L static void clif_mvp_exp(struct map_session_data *sd, unsigned int exp) { -#if PACKETVER >= 20131223 // Kro removed this packet [Napster] - if (battle_config.mvp_exp_reward_message) { - char e_msg[CHAT_SIZE_MAX]; - sprintf(e_msg, msg_txt(855), exp); - clif->messagecolor_self(sd->fd, COLOR_CYAN, e_msg); // Congratulations! You are the MVP! Your reward EXP Points are %u !! - } -#else +#if PACKETVER_RE_NUM >= 20080827 || PACKETVER_MAIN_NUM >= 20090401 || defined(PACKETVER_ZERO) int fd; nullpo_retv(sd); - fd=sd->fd; - WFIFOHEAD(fd,packet_len(0x10b)); - WFIFOW(fd,0)=0x10b; - WFIFOL(fd,2)=cap_value(exp,0,INT32_MAX); - WFIFOSET(fd,packet_len(0x10b)); + fd = sd->fd; + WFIFOHEAD(fd, packet_len(0x10b)); + WFIFOW(fd, 0) = 0x10b; + WFIFOL(fd, 2) = cap_value(exp, 0, INT32_MAX); + WFIFOSET(fd, packet_len(0x10b)); #endif } @@ -8825,8 +8935,8 @@ static void clif_refresh_storagewindow(struct map_session_data *sd) if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) { if (sd->storage.aggregate > 0) { storage->sortitem(VECTOR_DATA(sd->storage.item), VECTOR_LENGTH(sd->storage.item)); - clif->storagelist(sd, VECTOR_DATA(sd->storage.item), VECTOR_LENGTH(sd->storage.item)); } + clif->storageList(sd, VECTOR_DATA(sd->storage.item), VECTOR_LENGTH(sd->storage.item)); clif->updatestorageamount(sd, sd->storage.aggregate, MAX_STORAGE); } // Notify the client that the gstorage is open otherwise it will @@ -8838,7 +8948,7 @@ static void clif_refresh_storagewindow(struct map_session_data *sd) intif->request_guild_storage(sd->status.account_id,sd->status.guild_id); } else { storage->sortitem(gstor->items, ARRAYLENGTH(gstor->items)); - clif->storagelist(sd, gstor->items, ARRAYLENGTH(gstor->items)); + clif->guildStorageList(sd, gstor->items, ARRAYLENGTH(gstor->items)); clif->updatestorageamount(sd, gstor->storage_amount, MAX_GUILD_STORAGE); } } @@ -8850,9 +8960,9 @@ static void clif_refresh(struct map_session_data *sd) nullpo_retv(sd); clif->changemap(sd,sd->bl.m,sd->bl.x,sd->bl.y); - clif->inventorylist(sd); + clif->inventoryList(sd); if(pc_iscarton(sd)) { - clif->cartlist(sd); + clif->cartList(sd); clif->updatestatus(sd,SP_CARTINFO); } clif->updatestatus(sd,SP_WEIGHT); @@ -9884,11 +9994,11 @@ static void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) // Send character inventory to the client. // call this before pc->checkitem() so that the client isn't called to delete a non-existent item. - clif->inventorylist(sd); + clif->inventoryList(sd); // Send the cart inventory, counts & weight to the client. if(pc_iscarton(sd)) { - clif->cartlist(sd); + clif->cartList(sd); clif->updatestatus(sd, SP_CARTINFO); } @@ -11088,7 +11198,7 @@ static void clif_parse_DropItem(int fd, struct map_session_data *sd) } //Because the client does not like being ignored. - clif->item_movefailed(sd, item_index); + clif->dropitem(sd, item_index, 0); } static void clif_parse_UseItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); @@ -21747,6 +21857,17 @@ static void clif_party_dead_notification(struct map_session_data *sd) #endif } +static void clif_parse_memorial_dungeon_command(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); +static void clif_parse_memorial_dungeon_command(int fd, struct map_session_data *sd) +{ + const struct PACKET_CZ_MEMORIALDUNGEON_COMMAND *p = RP2PTR(fd); + + switch (p->command) { + case COMMAND_MEMORIALDUNGEON_DESTROY_FORCE: + instance->force_destroy(sd); + } +} + /*========================================== * Main client packet processing function *------------------------------------------*/ @@ -22197,9 +22318,12 @@ void clif_defaults(void) clif->combo_delay = clif_combo_delay; clif->status_change = clif_status_change; clif->insert_card = clif_insert_card; - clif->inventorylist = clif_inventorylist; - clif->equiplist = clif_equiplist; - clif->cartlist = clif_cartlist; + clif->inventoryList = clif_inventoryList; + clif->inventoryItems = clif_inventoryItems; + clif->equipList = clif_equipList; + clif->equipItems = clif_equipItems; + clif->cartList = clif_cartList; + clif->cartItems = clif_cartItems; clif->favorite_item = clif_favorite_item; clif->clearcart = clif_clearcart; clif->item_identify_list = clif_item_identify_list; @@ -22355,7 +22479,11 @@ void clif_defaults(void) clif->openvendingAck = clif_openvendingAck; clif->vendingreport = clif_vendingreport; /* storage handling */ - clif->storagelist = clif_storagelist; + clif->storageList = clif_storageList; + clif->guildStorageList = clif_guildStorageList; + clif->storageItems = clif_storageItems; + clif->inventoryStart = clif_inventoryStart; + clif->inventoryEnd = clif_inventoryEnd; clif->updatestorageamount = clif_updatestorageamount; clif->storageitemadded = clif_storageitemadded; clif->storageitemremoved = clif_storageitemremoved; @@ -22902,4 +23030,5 @@ void clif_defaults(void) clif->pPetEvolution = clif_parse_pet_evolution; clif->petEvolutionResult = clif_pet_evolution_result; + clif->pMemorialDungeonCommand = clif_parse_memorial_dungeon_command; } diff --git a/src/map/clif.h b/src/map/clif.h index e3b2a90d3..86e53e1e9 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -612,6 +612,16 @@ enum pet_evolution_result { }; /** + * Inventory type for clients 2018-09-12 RE + + **/ +enum inventory_type { + INVTYPE_INVENTORY = 0, + INVTYPE_CART = 1, + INVTYPE_STORAGE = 2, + INVTYPE_GUILD_STORAGE = 3, +}; + +/** * Structures **/ typedef void (*pFunc)(int, struct map_session_data *); //cant help but put it first @@ -660,6 +670,10 @@ enum stylist_shop { STYLIST_SHOP_FAILURE }; +enum memorial_dungeon_command { + COMMAND_MEMORIALDUNGEON_DESTROY_FORCE = 0x3, +}; + /** * Clif.c Interface **/ @@ -827,9 +841,12 @@ struct clif_interface { void (*combo_delay) (struct block_list *bl,int wait); void (*status_change) (struct block_list *bl,int type,int flag,int tick,int val1, int val2, int val3); void (*insert_card) (struct map_session_data *sd,int idx_equip,int idx_card,int flag); - void (*inventorylist) (struct map_session_data *sd); - void (*equiplist) (struct map_session_data *sd); - void (*cartlist) (struct map_session_data *sd); + void (*inventoryList) (struct map_session_data *sd); + void (*inventoryItems) (struct map_session_data *sd, enum inventory_type type); + void (*equipList) (struct map_session_data *sd); + void (*equipItems) (struct map_session_data *sd, enum inventory_type type); + void (*cartList) (struct map_session_data *sd); + void (*cartItems) (struct map_session_data *sd, enum inventory_type type); void (*favorite_item) (struct map_session_data* sd, unsigned short index); void (*clearcart) (int fd); void (*item_identify_list) (struct map_session_data *sd); @@ -986,7 +1003,11 @@ struct clif_interface { void (*openvendingAck) (int fd, int result); void (*vendingreport) (struct map_session_data* sd, int index, int amount, uint32 char_id, int zeny); /* storage handling */ - void (*storagelist) (struct map_session_data* sd, struct item* items, int items_length); + void (*storageList) (struct map_session_data* sd, struct item* items, int items_length); + void (*guildStorageList) (struct map_session_data* sd, struct item* items, int items_length); + void (*storageItems) (struct map_session_data* sd, enum inventory_type type, struct item* items, int items_length); + void (*inventoryStart) (struct map_session_data* sd, enum inventory_type type, const char* name); + void (*inventoryEnd) (struct map_session_data* sd, enum inventory_type type); void (*updatestorageamount) (struct map_session_data* sd, int amount, int max_amount); void (*storageitemadded) (struct map_session_data* sd, struct item* i, int index, int amount); void (*storageitemremoved) (struct map_session_data* sd, int index, int amount); @@ -1527,6 +1548,7 @@ struct clif_interface { void (*pPetEvolution) (int fd, struct map_session_data *sd); void (*petEvolutionResult) (int fd, enum pet_evolution_result result); void (*party_dead_notification) (struct map_session_data *sd); + void (*pMemorialDungeonCommand) (int fd, struct map_session_data *sd); }; #ifdef HERCULES_CORE diff --git a/src/map/instance.c b/src/map/instance.c index 8bd45ba50..1e83b0b76 100644 --- a/src/map/instance.c +++ b/src/map/instance.c @@ -727,6 +727,66 @@ static void instance_check_kick(struct map_session_data *sd) } } +/** + * Look up existing memorial dungeon of the player and destroy it + * + * @param sd session data. + * + */ +static void instance_force_destroy(struct map_session_data *sd) +{ + nullpo_retv(sd); + + for (int i = 0; i < instance->instances; ++i) { + switch (instance->list[i].owner_type) { + case IOT_CHAR: + { + if (instance->list[i].owner_id != sd->status.char_id) + continue; + break; + } + case IOT_PARTY: + { + int party_id = sd->status.party_id; + if (instance->list[i].owner_id != party_id) + continue; + int j = 0; + struct party_data *pt = party->search(party_id); + nullpo_retv(pt); + + ARR_FIND(0, MAX_PARTY, j, pt->party.member[j].leader); + if (j == MAX_PARTY) { + ShowWarning("clif_parse_memorial_dungeon_command: trying to destroy a party instance, while the party has no leader."); + return; + } + if (pt->party.member[j].char_id != sd->status.char_id) { + ShowWarning("clif_parse_memorial_dungeon_command: trying to destroy a party instance, from a non party-leader player."); + return; + } + break; + } + case IOT_GUILD: + { + int guild_id = sd->status.guild_id; + if (instance->list[i].owner_id != guild_id) + continue; + struct guild *g = guild->search(guild_id); + nullpo_retv(g); + + if (g->member[0].char_id != sd->status.char_id) { + ShowWarning("clif_parse_memorial_dungeon_command: trying to destroy a guild instance, from a non guild-master player."); + return; + } + break; + } + default: + continue; + } + instance->destroy(instance->list[i].id); + return; + } +} + static void do_reload_instance(void) { struct s_mapiterator *iter; @@ -810,4 +870,5 @@ void instance_defaults(void) instance->set_timeout = instance_set_timeout; instance->valid = instance_is_valid; instance->destroy_timer = instance_destroy_timer; + instance->force_destroy = instance_force_destroy; } diff --git a/src/map/instance.h b/src/map/instance.h index ff7e49a7f..91928bf40 100644 --- a/src/map/instance.h +++ b/src/map/instance.h @@ -96,6 +96,7 @@ struct instance_interface { void (*set_timeout) (int instance_id, unsigned int progress_timeout, unsigned int idle_timeout); bool (*valid) (int instance_id); int (*destroy_timer) (int tid, int64 tick, int id, intptr_t data); + void (*force_destroy) (struct map_session_data *sd); }; #ifdef HERCULES_CORE diff --git a/src/map/map.h b/src/map/map.h index cf3a4e57c..d50666d4b 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -789,6 +789,12 @@ struct questinfo_qreq { int state; }; +struct questinfo_itemreq { + int nameid; + int min; + int max; +}; + struct questinfo { struct npc_data *nd; unsigned short icon; @@ -805,7 +811,7 @@ struct questinfo { int min; int max; } job_level; - VECTOR_DECL(struct item) items; + VECTOR_DECL(struct questinfo_itemreq) items; struct s_homunculus homunculus; int homunculus_type; VECTOR_DECL(struct questinfo_qreq) quest_requirement; diff --git a/src/map/messages_main.h b/src/map/messages_main.h index dd000d2f1..f26fdb50b 100644 --- a/src/map/messages_main.h +++ b/src/map/messages_main.h @@ -23,7 +23,7 @@ /* This file is autogenerated, please do not commit manual changes -Latest version: 20180808 +Latest version: 20180829 */ enum clif_messages { @@ -21267,6 +21267,24 @@ DEATH : %.1f%% ( basic 100.0%% %s %.1f%%) */ MSG_ID_DD1 = 0xdd1, #endif +#if PACKETVER >= 20180829 +/*20180829 to latest +영문이나 러시아어 단독으로만 사용이 가능합니다. +*/ + MSG_ID_DD2 = 0xdd2, +/*20180829 to latest +you must have an AccessTicket to login +*/ + MSG_ID_DD3 = 0xdd3, +/*20180829 to latest +창고를 불러오는 중입니다. +*/ + MSG_ID_DD4 = 0xdd4, +/*20180829 to latest +NOW LOADING.. +*/ + MSG_ID_DD5 = 0xdd5, +#endif }; #endif /* MAP_MESSAGES_MAIN_H */ diff --git a/src/map/messages_re.h b/src/map/messages_re.h index bf2927d6b..c263150e3 100644 --- a/src/map/messages_re.h +++ b/src/map/messages_re.h @@ -23,7 +23,7 @@ /* This file is autogenerated, please do not commit manual changes -Latest version: 20180808 +Latest version: 20180919 */ enum clif_messages { @@ -20746,6 +20746,62 @@ DEATH : %.1f%% ( basic 100.0%% %s %.1f%%) */ MSG_ID_DD1 = 0xdd1, #endif +#if PACKETVER >= 20180829 +/*20180829 to latest +영문이나 러시아어 단독으로만 사용이 가능합니다. +*/ + MSG_ID_DD2 = 0xdd2, +/*20180829 to latest +you must have an AccessTicket to login +*/ + MSG_ID_DD3 = 0xdd3, +/*20180829 to latest +창고를 불러오는 중입니다. +*/ + MSG_ID_DD4 = 0xdd4, +/*20180829 to latest +NOW LOADING.. +*/ + MSG_ID_DD5 = 0xdd5, +#endif +#if PACKETVER >= 20180919 +/*20180919 to latest +삭제 +*/ + MSG_ID_DD6 = 0xdd6, +/*20180919 to latest +답장 +*/ + MSG_ID_DD7 = 0xdd7, +/*20180919 to latest +전송 +*/ + MSG_ID_DD8 = 0xdd8, +/*20180919 to latest +이름확인 +*/ + MSG_ID_DD9 = 0xdd9, +/*20180919 to latest +공지 +Notice +*/ + MSG_ID_DDA = 0xdda, +/*20180919 to latest +일반 +General +*/ + MSG_ID_DDB = 0xddb, +/*20180919 to latest +반송 +Clear +*/ + MSG_ID_DDC = 0xddc, +/*20180919 to latest +검색 +Search +*/ + MSG_ID_DDD = 0xddd, +#endif }; #endif /* MAP_MESSAGES_RE_H */ diff --git a/src/map/messages_zero.h b/src/map/messages_zero.h index 05e3f1479..c562bb07c 100644 --- a/src/map/messages_zero.h +++ b/src/map/messages_zero.h @@ -23,7 +23,7 @@ /* This file is autogenerated, please do not commit manual changes -Latest version: 20180822 +Latest version: 20180919 */ enum clif_messages { @@ -17371,9 +17371,55 @@ you must have an AccessTicket to login MSG_ID_DD3 = 0xdd3, /*20180725 to 20180801 -- +20180905 to latest +창고를 불러오는 중입니다. */ MSG_ID_DD4 = 0xdd4, #endif +#if PACKETVER >= 20180905 +/*20180905 to latest +NOW LOADING.. +*/ + MSG_ID_DD5 = 0xdd5, +#endif +#if PACKETVER >= 20180919 +/*20180919 to latest +삭제 +*/ + MSG_ID_DD6 = 0xdd6, +/*20180919 to latest +답장 +*/ + MSG_ID_DD7 = 0xdd7, +/*20180919 to latest +전송 +*/ + MSG_ID_DD8 = 0xdd8, +/*20180919 to latest +이름확인 +*/ + MSG_ID_DD9 = 0xdd9, +/*20180919 to latest +공지 +Notice +*/ + MSG_ID_DDA = 0xdda, +/*20180919 to latest +일반 +General +*/ + MSG_ID_DDB = 0xddb, +/*20180919 to latest +반송 +Clear +*/ + MSG_ID_DDC = 0xddc, +/*20180919 to latest +검색 +Search +*/ + MSG_ID_DDD = 0xddd, +#endif }; #endif /* MAP_MESSAGES_ZERO_H */ diff --git a/src/map/npc.h b/src/map/npc.h index eff4ed4ec..ed5f4138d 100644 --- a/src/map/npc.h +++ b/src/map/npc.h @@ -144,7 +144,7 @@ enum actor_classes { #define MAX_NPC_CLASS 1000 // New NPC range #define MAX_NPC_CLASS2_START 10001 -#define MAX_NPC_CLASS2_END 10248 +#define MAX_NPC_CLASS2_END 10310 //Script NPC events. enum npce_event { diff --git a/src/map/packets.h b/src/map/packets.h index 1d1046e8a..a897601b3 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -1142,7 +1142,7 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x02cc,4); packet(0x02cd,26); packet(0x02ce,10); - packet(0x02cf,6); + packet(0x02cf,6,clif->pMemorialDungeonCommand); packet(0x02d0,-1); packet(0x02d1,-1); packet(0x02d2,-1); @@ -4270,4 +4270,71 @@ packet(0x96e,-1,clif->ackmergeitems); // changed packet sizes #endif +// 2018-08-29aRagexe +#if PACKETVER_MAIN_NUM >= 20180829 +// new packets + packet(0x0b05,59); + packet(0x0b06,53,clif->pDull/*,XXX*/); + packet(0x0b07,-1); + packet(0x0b08,26); // ZC_INVENTORY_START + packet(0x0b09,-1); // ZC_STORE_ITEMLIST_NORMAL_V6 + packet(0x0b0a,-1); // ZC_STORE_ITEMLIST_EQUIP_V6 + packet(0x0b0b,3); // ZC_INVENTORY_END + packet(0x0b0c,155,clif->pDull/*,XXX*/); +// changed packet sizes +#endif + +// 2018-08-29aRagexeRE +#if PACKETVER_RE_NUM >= 20180829 +// new packets + packet(0x0b05,63); + packet(0x0b06,53,clif->pDull/*,XXX*/); + packet(0x0b07,-1); + packet(0x0b08,26); // ZC_INVENTORY_START + packet(0x0b09,-1); // ZC_STORE_ITEMLIST_NORMAL_V6 + packet(0x0b0a,-1); // ZC_STORE_ITEMLIST_EQUIP_V6 + packet(0x0b0b,3); // ZC_INVENTORY_END + packet(0x0b0c,155,clif->pDull/*,XXX*/); +// changed packet sizes +#endif + +// 2018-09-05aRagexe_zero +#if PACKETVER_ZERO_NUM >= 20180905 +// new packets + packet(0x0b0d,6,clif->pDull/*,XXX*/); +// changed packet sizes + packet(0x0b08,27); // ZC_INVENTORY_START + packet(0x0b0b,4); // ZC_INVENTORY_END +#endif + +#ifndef PACKETVER_ZERO +// 2018-09-12dRagexe, 2018-09-12dRagexeRE +#if PACKETVER >= 20180912 +// new packets + packet(0x0b0d,10,clif->pDull/*,XXX*/); + packet(0x0b0e,-1,clif->pDull/*,XXX*/); + packet(0x0b0f,-1,clif->pDull/*,XXX*/); +// changed packet sizes + packet(0x0b08,27,clif->pDull/*,XXX*/); // ZC_INVENTORY_START + packet(0x0b0b,4,clif->pDull/*,XXX*/); // ZC_INVENTORY_END +#endif +#endif + +// 2018-09-19aRagexeRE +#if PACKETVER_RE_NUM >= 20180919 +// new packets +// changed packet sizes + packet(0x0b08,-1); // ZC_INVENTORY_START +#endif + +// 2018-09-19aRagexe_zero +#if PACKETVER_ZERO_NUM >= 20180919 +// new packets + packet(0x0b0e,-1,clif->pDull/*,XXX*/); + packet(0x0b0f,-1,clif->pDull/*,XXX*/); +// changed packet sizes + packet(0x0b08,-1); // ZC_INVENTORY_START + packet(0x0b0d,10,clif->pDull/*,XXX*/); +#endif + #endif /* MAP_PACKETS_H */ diff --git a/src/map/packets_keys_main.h b/src/map/packets_keys_main.h index 6e7f27166..a9d9a7020 100644 --- a/src/map/packets_keys_main.h +++ b/src/map/packets_keys_main.h @@ -874,7 +874,7 @@ packetKeys(0x6A596301,0x76866D0E,0x32294A45); #endif -// 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 +// 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 #if PACKETVER == 20131223 || \ PACKETVER == 20140508 || \ PACKETVER == 20140611 || \ @@ -899,7 +899,11 @@ PACKETVER == 20180718 || \ PACKETVER == 20180801 || \ PACKETVER == 20180808 || \ - PACKETVER >= 20180822 + PACKETVER == 20180822 || \ + PACKETVER == 20180829 || \ + PACKETVER == 20180831 || \ + PACKETVER == 20180912 || \ + PACKETVER >= 20180919 packetKeys(0x00000000,0x00000000,0x00000000); #endif diff --git a/src/map/packets_keys_zero.h b/src/map/packets_keys_zero.h index 42a6aaf37..bbc1f7332 100644 --- a/src/map/packets_keys_zero.h +++ b/src/map/packets_keys_zero.h @@ -29,7 +29,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 +// 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 #if PACKETVER == 20171018 || \ PACKETVER == 20171019 || \ PACKETVER == 20171023 || \ @@ -54,7 +54,11 @@ PACKETVER == 20180725 || \ PACKETVER == 20180801 || \ PACKETVER == 20180808 || \ - PACKETVER >= 20180822 + PACKETVER == 20180822 || \ + PACKETVER == 20180829 || \ + PACKETVER == 20180905 || \ + PACKETVER == 20180912 || \ + PACKETVER >= 20180919 packetKeys(0x00000000,0x00000000,0x00000000); #endif diff --git a/src/map/packets_shuffle_main.h b/src/map/packets_shuffle_main.h index 441415df2..8bc395da1 100644 --- a/src/map/packets_shuffle_main.h +++ b/src/map/packets_shuffle_main.h @@ -3344,7 +3344,7 @@ packet(0x0969,2,clif->pSearchStoreInfoNextPage,0); // CZ_SEARCH_STORE_INFO_NEXT_PAGE #endif -// 2014-06-11eRagexe, 2015-02-25hRagexe, 2018-03-15aRagexe, 2018-03-21aRagexe, 2018-03-28bRagexe, 2018-04-04bRagexe, 2018-04-18aRagexe, 2018-04-25cRagexe, 2018-05-02bRagexe, 2018-05-09aRagexe, 2018-05-16cRagexe, 2018-05-23aRagexe, 2018-05-30aRagexe, 2018-06-05bRagexe, 2018-06-20cRagexe, 2018-06-20eRagexe, 2018-06-21aRagexe, 2018-07-04aRagexe, 2018-07-18bRagexe, 2018-07-18cRagexe, 2018-08-01cRagexe, 2018-08-08bRagexe, 2018-08-22cRagexe +// 2014-06-11eRagexe, 2015-02-25hRagexe, 2018-03-15aRagexe, 2018-03-21aRagexe, 2018-03-28bRagexe, 2018-04-04bRagexe, 2018-04-18aRagexe, 2018-04-25cRagexe, 2018-05-02bRagexe, 2018-05-09aRagexe, 2018-05-16cRagexe, 2018-05-23aRagexe, 2018-05-30aRagexe, 2018-06-05bRagexe, 2018-06-20cRagexe, 2018-06-20eRagexe, 2018-06-21aRagexe, 2018-07-04aRagexe, 2018-07-18bRagexe, 2018-07-18cRagexe, 2018-08-01cRagexe, 2018-08-08bRagexe, 2018-08-22cRagexe, 2018-08-29aRagexe, 2018-08-31aRagexe, 2018-09-12dRagexe, 2018-09-19aRagexe #if PACKETVER == 20140611 || \ PACKETVER == 20150225 || \ PACKETVER == 20180315 || \ @@ -3365,7 +3365,11 @@ PACKETVER == 20180718 || \ PACKETVER == 20180801 || \ PACKETVER == 20180808 || \ - PACKETVER >= 20180822 + PACKETVER == 20180822 || \ + PACKETVER == 20180829 || \ + PACKETVER == 20180831 || \ + PACKETVER == 20180912 || \ + PACKETVER >= 20180919 packet(0x0202,26,clif->pFriendsListAdd,2); // CZ_ADD_FRIENDS packet(0x022d,5,clif->pHomMenu,2,4); // CZ_COMMAND_MER packet(0x023b,36,clif->pStoragePassword,0); // CZ_ACK_STORE_PASSWORD diff --git a/src/map/packets_shuffle_re.h b/src/map/packets_shuffle_re.h index ee268a8f5..157a8a431 100644 --- a/src/map/packets_shuffle_re.h +++ b/src/map/packets_shuffle_re.h @@ -9662,13 +9662,16 @@ packet(0x083c,12,clif->pSearchStoreInfoListItemClick,2,6,10); // CZ_SSILIST_ITEM_CLICK #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-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 #if PACKETVER == 20180704 || \ PACKETVER == 20180711 || \ PACKETVER == 20180718 || \ PACKETVER == 20180801 || \ PACKETVER == 20180808 || \ - PACKETVER >= 20180822 + PACKETVER == 20180822 || \ + PACKETVER == 20180829 || \ + PACKETVER == 20180912 || \ + PACKETVER >= 20180919 packet(0x0202,26,clif->pFriendsListAdd,2); // CZ_ADD_FRIENDS packet(0x022d,5,clif->pHomMenu,2,4); // CZ_COMMAND_MER packet(0x023b,36,clif->pStoragePassword,0); // CZ_ACK_STORE_PASSWORD diff --git a/src/map/packets_shuffle_zero.h b/src/map/packets_shuffle_zero.h index 479cf634a..b7253fdda 100644 --- a/src/map/packets_shuffle_zero.h +++ b/src/map/packets_shuffle_zero.h @@ -36,7 +36,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 +// 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 #if PACKETVER == 20171018 || \ PACKETVER == 20171019 || \ PACKETVER == 20171023 || \ @@ -61,7 +61,11 @@ PACKETVER == 20180725 || \ PACKETVER == 20180801 || \ PACKETVER == 20180808 || \ - PACKETVER >= 20180822 + PACKETVER == 20180822 || \ + PACKETVER == 20180829 || \ + PACKETVER == 20180905 || \ + PACKETVER == 20180912 || \ + PACKETVER >= 20180919 packet(0x0202,26,clif->pFriendsListAdd,2); // CZ_ADD_FRIENDS packet(0x022d,5,clif->pHomMenu,2,4); // CZ_COMMAND_MER packet(0x023b,36,clif->pStoragePassword,0); // CZ_ACK_STORE_PASSWORD diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 852a44cb8..af76a66d7 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -198,7 +198,9 @@ enum packet_headers { #else dropflooritemType = 0x9e, #endif -#if PACKETVER >= 20120925 +#if PACKETVER_RE_NUM >= 20180912 || PACKETVER_ZERO_NUM >= 20180919 + inventorylistnormalType = 0xb09, +#elif PACKETVER >= 20120925 inventorylistnormalType = 0x991, #elif PACKETVER >= 20080102 inventorylistnormalType = 0x2e8, @@ -207,7 +209,9 @@ enum packet_headers { #else inventorylistnormalType = 0xa3, #endif -#if PACKETVER >= 20150226 +#if PACKETVER_RE_NUM >= 20180912 || PACKETVER_ZERO_NUM >= 20180919 + inventorylistequipType = 0xb0a, +#elif PACKETVER >= 20150226 inventorylistequipType = 0xa0d, #elif PACKETVER >= 20120925 inventorylistequipType = 0x992, @@ -218,27 +222,33 @@ enum packet_headers { #else inventorylistequipType = 0xa4, #endif -#if PACKETVER >= 20120925 - storagelistnormalType = 0x995, +#if PACKETVER_RE_NUM >= 20180829 || PACKETVER_ZERO_NUM >= 20180919 + storageListNormalType = 0xb09, +#elif PACKETVER >= 20120925 + storageListNormalType = 0x995, #elif PACKETVER >= 20080102 - storagelistnormalType = 0x2ea, + storageListNormalType = 0x2ea, #elif PACKETVER >= 20071002 - storagelistnormalType = 0x295, + storageListNormalType = 0x295, #else - storagelistnormalType = 0xa5, + storageListNormalType = 0xa5, #endif -#if PACKETVER >= 20150226 - storagelistequipType = 0xa10, +#if PACKETVER_RE_NUM >= 20180829 || PACKETVER_ZERO_NUM >= 20180919 + storageListEquipType = 0xb0a, +#elif PACKETVER >= 20150226 + storageListEquipType = 0xa10, #elif PACKETVER >= 20120925 - storagelistequipType = 0x996, + storageListEquipType = 0x996, #elif PACKETVER >= 20080102 - storagelistequipType = 0x2d1, + storageListEquipType = 0x2d1, #elif PACKETVER >= 20071002 - storagelistequipType = 0x296, + storageListEquipType = 0x296, #else - storagelistequipType = 0xa6, + storageListEquipType = 0xa6, #endif -#if PACKETVER >= 20120925 +#if PACKETVER_RE_NUM >= 20180829 || PACKETVER_ZERO_NUM >= 20180919 + cartlistnormalType = 0xb09, +#elif PACKETVER >= 20120925 cartlistnormalType = 0x993, #elif PACKETVER >= 20080102 cartlistnormalType = 0x2e9, @@ -247,7 +257,9 @@ enum packet_headers { #else cartlistnormalType = 0x123, #endif -#if PACKETVER >= 20150226 +#if PACKETVER_RE_NUM >= 20180829 || PACKETVER_ZERO_NUM >= 20180919 + cartlistequipType = 0xb0a, +#elif PACKETVER >= 20150226 cartlistequipType = 0xa0f, #elif PACKETVER >= 20120925 cartlistequipType = 0x994, @@ -1162,28 +1174,63 @@ struct packet_roulette_itemrecv_ack { struct packet_itemlist_normal { int16 PacketType; int16 PacketLength; +#if PACKETVER_RE_NUM >= 20180912 || PACKETVER_ZERO_NUM >= 20180919 + uint8 invType; +#endif struct NORMALITEM_INFO list[MAX_ITEMLIST]; } __attribute__((packed)); struct packet_itemlist_equip { int16 PacketType; int16 PacketLength; +#if PACKETVER_RE_NUM >= 20180912 || PACKETVER_ZERO_NUM >= 20180919 + uint8 invType; +#endif struct EQUIPITEM_INFO list[MAX_ITEMLIST]; } __attribute__((packed)); -struct packet_storelist_normal { +struct ZC_STORE_ITEMLIST_NORMAL { int16 PacketType; int16 PacketLength; -#if PACKETVER >= 20120925 +#if PACKETVER_RE_NUM >= 20180912 || PACKETVER_ZERO_NUM >= 20180919 + uint8 invType; +#endif +#if PACKETVER >= 20120925 && PACKETVER_RE_NUM < 20180829 && PACKETVER_ZERO_NUM < 20180919 char name[NAME_LENGTH]; #endif struct NORMALITEM_INFO list[MAX_ITEMLIST]; } __attribute__((packed)); -struct packet_storelist_equip { +struct ZC_INVENTORY_START { + int16 packetType; +#if PACKETVER_RE_NUM >= 20180919 || PACKETVER_ZERO_NUM >= 20180919 + int16 packetLength; +#endif +#if PACKETVER_RE_NUM >= 20180912 || PACKETVER_ZERO_NUM >= 20180919 + uint8 invType; +#endif +#if PACKETVER_RE_NUM >= 20180919 || PACKETVER_ZERO_NUM >= 20180919 + char name[]; +#else + char name[NAME_LENGTH]; +#endif +} __attribute__((packed)); + +struct ZC_INVENTORY_END { + int16 packetType; +#if PACKETVER_RE_NUM >= 20180912 || PACKETVER_ZERO_NUM >= 20180919 + uint8 invType; +#endif + char flag; +} __attribute__((packed)); + +struct ZC_STORE_ITEMLIST_EQUIP { int16 PacketType; int16 PacketLength; -#if PACKETVER >= 20120925 +#if PACKETVER_RE_NUM >= 20180912 || PACKETVER_ZERO_NUM >= 20180919 + uint8 invType; +#endif +#if PACKETVER >= 20120925 && PACKETVER_RE_NUM < 20180829 && PACKETVER_ZERO_NUM < 20180919 char name[NAME_LENGTH]; #endif struct EQUIPITEM_INFO list[MAX_ITEMLIST]; @@ -2784,6 +2831,11 @@ struct PACKET_ZC_ACK_LEAVE_GUILD2 { char reason[40]; } __attribute__((packed)); +struct PACKET_CZ_MEMORIALDUNGEON_COMMAND { + int16 packetType; + int32 command; +} __attribute__((packed)); + #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 be28f8dad..961dda9f5 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -2075,7 +2075,7 @@ static int pc_disguise(struct map_session_data *sd, int class) clif->spawn(&sd->bl); if (class == sd->status.class && pc_iscarton(sd)) { //It seems the cart info is lost on undisguise. - clif->cartlist(sd); + clif->cartList(sd); clif->updatestatus(sd,SP_CARTINFO); } if (sd->chat_id != 0) { @@ -9198,7 +9198,7 @@ static int pc_setoption(struct map_session_data *sd, int type) #ifndef NEW_CARTS if( type&OPTION_CART && !( p_type&OPTION_CART ) ) { //Cart On - clif->cartlist(sd); + clif->cartList(sd); clif->updatestatus(sd, SP_CARTINFO); if(pc->checkskill(sd, MC_PUSHCART) < 10) status_calc_pc(sd,SCO_NONE); //Apply speed penalty. @@ -9305,7 +9305,7 @@ static int pc_setcart(struct map_session_data *sd, int type) break; default:/* everything else is an allowed ID so we can move on */ if( !sd->sc.data[SC_PUSH_CART] ) /* first time, so fill cart data */ - clif->cartlist(sd); + clif->cartList(sd); clif->updatestatus(sd, SP_CARTINFO); sc_start(NULL,&sd->bl, SC_PUSH_CART, 100, type, 0); clif->sc_load(&sd->bl, sd->bl.id, AREA, SI_ON_PUSH_CART, type, 0, 0); diff --git a/src/map/pet.c b/src/map/pet.c index cfb3e8253..c32a92b78 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -350,7 +350,7 @@ static int pet_return_egg(struct map_session_data *sd, struct pet_data *pd) sd->status.inventory[i].bound = IBT_NONE; } #if PACKETVER >= 20180704 - clif->inventorylist(sd); + clif->inventoryList(sd); clif->send_petdata(sd, pd, 6, 0); #endif pd->pet.incubate = 1; diff --git a/src/map/quest.c b/src/map/quest.c index ab0b06974..02bf7638b 100644 --- a/src/map/quest.c +++ b/src/map/quest.c @@ -805,18 +805,17 @@ static bool quest_questinfo_validate_joblevel(struct map_session_data *sd, struc */ static bool quest_questinfo_validate_items(struct map_session_data *sd, struct questinfo *qi) { - int i, idx; - nullpo_retr(false, sd); nullpo_retr(false, qi); - - for (i = 0; i < VECTOR_LENGTH(qi->items); i++) { - struct item *item = &VECTOR_INDEX(qi->items, i); - idx = pc->search_inventory(sd, item->nameid); - if (idx == INDEX_NOT_FOUND) - return false; - if (sd->status.inventory[idx].amount < item->amount) + for (int i = 0; i < VECTOR_LENGTH(qi->items); i++) { + struct questinfo_itemreq *item = &VECTOR_INDEX(qi->items, i); + int count = 0; + for (int j = 0; j < MAX_INVENTORY; j++) { + if (sd->status.inventory[j].nameid == item->nameid) + count += sd->status.inventory[j].amount; + } + if (count < item->min || count > item->max) return false; } @@ -887,7 +886,14 @@ static bool quest_questinfo_validate_quests(struct map_session_data *sd, struct for (i = 0; i < VECTOR_LENGTH(qi->quest_requirement); i++) { struct questinfo_qreq *quest_requirement = &VECTOR_INDEX(qi->quest_requirement, i); - if (quest->check(sd, quest_requirement->id, HAVEQUEST) != quest_requirement->state) + int quest_progress = quest->check(sd, quest_requirement->id, HAVEQUEST); + if (quest_progress == -1) + quest_progress = 0; + else if (quest_progress == 0 || quest_progress == 1) + quest_progress = 1; + else + quest_progress = 2; + if (quest_progress != quest_requirement->state) return false; } diff --git a/src/map/script.c b/src/map/script.c index 65ffc1a6d..f1bb63aa3 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -9361,7 +9361,7 @@ static BUILDIN(repair) if(num==repaircounter) { sd->status.inventory[i].attribute |= ATTR_BROKEN; sd->status.inventory[i].attribute ^= ATTR_BROKEN; - clif->equiplist(sd); + clif->equipList(sd); clif->produce_effect(sd, 0, sd->status.inventory[i].nameid); clif->misceffect(&sd->bl, 3); break; @@ -9398,7 +9398,7 @@ static BUILDIN(repairall) if(repaircounter) { clif->misceffect(&sd->bl, 3); - clif->equiplist(sd); + clif->equipList(sd); } return true; @@ -21114,17 +21114,26 @@ static BUILDIN(setquestinfo) } case QINFO_ITEM: { - struct item item = { 0 }; + struct questinfo_itemreq item = { 0 }; item.nameid = script_getnum(st, 3); - item.amount = script_getnum(st, 4); + item.min = script_hasdata(st, 4) ? script_getnum(st, 4) : 0; + item.max = script_hasdata(st, 5) ? script_getnum(st, 5) : 0; if (itemdb->exists(item.nameid) == NULL) { ShowWarning("buildin_setquestinfo: non existing item (%d) have been given.\n", item.nameid); return false; } - if (item.amount <= 0 || item.amount > MAX_AMOUNT) { - ShowWarning("buildin_setquestinfo: given amount (%d) must be bigger than 0 and smaller than %d.\n", item.amount, MAX_AMOUNT + 1); + if (item.min > item.max) { + ShowWarning("buildin_setquestinfo: minimal amount (%d) is bigger than the maximal amount (%d).\n", item.min, item.max); + return false; + } + if (item.min < 0 || item.min > MAX_AMOUNT) { + ShowWarning("buildin_setquestinfo: given amount (%d) must be bigger than or equal to 0 and smaller than %d.\n", item.min, MAX_AMOUNT + 1); + return false; + } + if (item.max < 0 || item.max > MAX_AMOUNT) { + ShowWarning("buildin_setquestinfo: given amount (%d) must be bigger than or equal to 0 and smaller than %d.\n", item.max, MAX_AMOUNT + 1); return false; } if (VECTOR_LENGTH(qi->items) == 0) @@ -25447,7 +25456,7 @@ static void script_parse_builtin(void) //Quest Log System [Inkfish] BUILDIN_DEF(questinfo, "i?"), - BUILDIN_DEF(setquestinfo, "i??"), + BUILDIN_DEF(setquestinfo, "i???"), BUILDIN_DEF(setquest, "i?"), BUILDIN_DEF(erasequest, "i?"), BUILDIN_DEF(completequest, "i?"), diff --git a/src/map/skill.c b/src/map/skill.c index c5579c2f6..4eaab5457 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -2588,7 +2588,7 @@ static int skill_break_equip(struct block_list *bl, unsigned short where, int ra pc->unequipitem(sd, j, PCUNEQUIPITEM_RECALC|PCUNEQUIPITEM_FORCE); } } - clif->equiplist(sd); + clif->equipList(sd); } return where; //Return list of pieces broken. @@ -16139,7 +16139,7 @@ static void skill_repairweapon(struct map_session_data *sd, int idx) item->attribute |= ATTR_BROKEN; item->attribute ^= ATTR_BROKEN; /* clear broken state */ - clif->equiplist(target_sd); + clif->equipList(target_sd); pc->delitem(sd, pc->search_inventory(sd, material), 1, 0, DELITEM_NORMAL, LOG_TYPE_CONSUME); // FIXME: is this the correct reason flag? @@ -16222,7 +16222,7 @@ static void skill_weaponrefine(struct map_session_data *sd, int idx) } clif->delitem(sd, idx, 1, DELITEM_NORMAL); clif->upgrademessage(sd->fd, 0,item->nameid); - clif->inventorylist(sd); + clif->inventoryList(sd); clif->refine(sd->fd,0,idx,item->refine); if (ep) pc->equipitem(sd,idx,ep); diff --git a/src/map/storage.c b/src/map/storage.c index ba8dcee3a..a6f0715e7 100644 --- a/src/map/storage.c +++ b/src/map/storage.c @@ -122,8 +122,8 @@ static int storage_storageopen(struct map_session_data *sd) if (sd->storage.aggregate > 0) { storage->sortitem(VECTOR_DATA(sd->storage.item), VECTOR_LENGTH(sd->storage.item)); - clif->storagelist(sd, VECTOR_DATA(sd->storage.item), VECTOR_LENGTH(sd->storage.item)); } + clif->storageList(sd, VECTOR_DATA(sd->storage.item), VECTOR_LENGTH(sd->storage.item)); clif->updatestorageamount(sd, sd->storage.aggregate, MAX_STORAGE); return 0; @@ -512,7 +512,7 @@ static int storage_guild_storageopen(struct map_session_data *sd) gstor->storage_status = 1; sd->state.storage_flag = STORAGE_FLAG_GUILD; storage->sortitem(gstor->items, ARRAYLENGTH(gstor->items)); - clif->storagelist(sd, gstor->items, ARRAYLENGTH(gstor->items)); + clif->guildStorageList(sd, gstor->items, ARRAYLENGTH(gstor->items)); clif->updatestorageamount(sd, gstor->storage_amount, MAX_GUILD_STORAGE); return 0; } diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index 52c7bb0f6..f80dc9003 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -1320,12 +1320,18 @@ typedef void (*HPMHOOK_pre_clif_status_change) (struct block_list **bl, int *typ typedef void (*HPMHOOK_post_clif_status_change) (struct block_list *bl, int type, int flag, int tick, int val1, int val2, int val3); typedef void (*HPMHOOK_pre_clif_insert_card) (struct map_session_data **sd, int *idx_equip, int *idx_card, int *flag); typedef void (*HPMHOOK_post_clif_insert_card) (struct map_session_data *sd, int idx_equip, int idx_card, int flag); -typedef void (*HPMHOOK_pre_clif_inventorylist) (struct map_session_data **sd); -typedef void (*HPMHOOK_post_clif_inventorylist) (struct map_session_data *sd); -typedef void (*HPMHOOK_pre_clif_equiplist) (struct map_session_data **sd); -typedef void (*HPMHOOK_post_clif_equiplist) (struct map_session_data *sd); -typedef void (*HPMHOOK_pre_clif_cartlist) (struct map_session_data **sd); -typedef void (*HPMHOOK_post_clif_cartlist) (struct map_session_data *sd); +typedef void (*HPMHOOK_pre_clif_inventoryList) (struct map_session_data **sd); +typedef void (*HPMHOOK_post_clif_inventoryList) (struct map_session_data *sd); +typedef void (*HPMHOOK_pre_clif_inventoryItems) (struct map_session_data **sd, enum inventory_type *type); +typedef void (*HPMHOOK_post_clif_inventoryItems) (struct map_session_data *sd, enum inventory_type type); +typedef void (*HPMHOOK_pre_clif_equipList) (struct map_session_data **sd); +typedef void (*HPMHOOK_post_clif_equipList) (struct map_session_data *sd); +typedef void (*HPMHOOK_pre_clif_equipItems) (struct map_session_data **sd, enum inventory_type *type); +typedef void (*HPMHOOK_post_clif_equipItems) (struct map_session_data *sd, enum inventory_type type); +typedef void (*HPMHOOK_pre_clif_cartList) (struct map_session_data **sd); +typedef void (*HPMHOOK_post_clif_cartList) (struct map_session_data *sd); +typedef void (*HPMHOOK_pre_clif_cartItems) (struct map_session_data **sd, enum inventory_type *type); +typedef void (*HPMHOOK_post_clif_cartItems) (struct map_session_data *sd, enum inventory_type type); typedef void (*HPMHOOK_pre_clif_favorite_item) (struct map_session_data **sd, unsigned short *index); typedef void (*HPMHOOK_post_clif_favorite_item) (struct map_session_data *sd, unsigned short index); typedef void (*HPMHOOK_pre_clif_clearcart) (int *fd); @@ -1620,8 +1626,16 @@ typedef void (*HPMHOOK_pre_clif_openvendingAck) (int *fd, int *result); typedef void (*HPMHOOK_post_clif_openvendingAck) (int fd, int result); typedef void (*HPMHOOK_pre_clif_vendingreport) (struct map_session_data **sd, int *index, int *amount, uint32 *char_id, int *zeny); typedef void (*HPMHOOK_post_clif_vendingreport) (struct map_session_data *sd, int index, int amount, uint32 char_id, int zeny); -typedef void (*HPMHOOK_pre_clif_storagelist) (struct map_session_data **sd, struct item **items, int *items_length); -typedef void (*HPMHOOK_post_clif_storagelist) (struct map_session_data *sd, struct item *items, int items_length); +typedef void (*HPMHOOK_pre_clif_storageList) (struct map_session_data **sd, struct item **items, int *items_length); +typedef void (*HPMHOOK_post_clif_storageList) (struct map_session_data *sd, struct item *items, int items_length); +typedef void (*HPMHOOK_pre_clif_guildStorageList) (struct map_session_data **sd, struct item **items, int *items_length); +typedef void (*HPMHOOK_post_clif_guildStorageList) (struct map_session_data *sd, struct item *items, int items_length); +typedef void (*HPMHOOK_pre_clif_storageItems) (struct map_session_data **sd, enum inventory_type *type, struct item **items, int *items_length); +typedef void (*HPMHOOK_post_clif_storageItems) (struct map_session_data *sd, enum inventory_type type, struct item *items, int items_length); +typedef void (*HPMHOOK_pre_clif_inventoryStart) (struct map_session_data **sd, enum inventory_type *type, const char **name); +typedef void (*HPMHOOK_post_clif_inventoryStart) (struct map_session_data *sd, enum inventory_type type, const char *name); +typedef void (*HPMHOOK_pre_clif_inventoryEnd) (struct map_session_data **sd, enum inventory_type *type); +typedef void (*HPMHOOK_post_clif_inventoryEnd) (struct map_session_data *sd, enum inventory_type type); typedef void (*HPMHOOK_pre_clif_updatestorageamount) (struct map_session_data **sd, int *amount, int *max_amount); typedef void (*HPMHOOK_post_clif_updatestorageamount) (struct map_session_data *sd, int amount, int max_amount); typedef void (*HPMHOOK_pre_clif_storageitemadded) (struct map_session_data **sd, struct item **i, int *index, int *amount); @@ -2600,6 +2614,8 @@ typedef void (*HPMHOOK_pre_clif_petEvolutionResult) (int *fd, enum pet_evolution typedef void (*HPMHOOK_post_clif_petEvolutionResult) (int fd, enum pet_evolution_result result); typedef void (*HPMHOOK_pre_clif_party_dead_notification) (struct map_session_data **sd); typedef void (*HPMHOOK_post_clif_party_dead_notification) (struct map_session_data *sd); +typedef void (*HPMHOOK_pre_clif_pMemorialDungeonCommand) (int *fd, struct map_session_data **sd); +typedef void (*HPMHOOK_post_clif_pMemorialDungeonCommand) (int fd, struct map_session_data *sd); #endif // MAP_CLIF_H #ifdef COMMON_CORE_H /* cmdline */ typedef void (*HPMHOOK_pre_cmdline_init) (void); @@ -3126,6 +3142,8 @@ typedef bool (*HPMHOOK_pre_instance_valid) (int *instance_id); typedef bool (*HPMHOOK_post_instance_valid) (bool retVal___, int instance_id); typedef int (*HPMHOOK_pre_instance_destroy_timer) (int *tid, int64 *tick, int *id, intptr_t *data); typedef int (*HPMHOOK_post_instance_destroy_timer) (int retVal___, int tid, int64 tick, int id, intptr_t data); +typedef void (*HPMHOOK_pre_instance_force_destroy) (struct map_session_data **sd); +typedef void (*HPMHOOK_post_instance_force_destroy) (struct map_session_data *sd); #endif // MAP_INSTANCE_H #ifdef CHAR_INT_ACHIEVEMENT_H /* inter_achievement */ typedef int (*HPMHOOK_pre_inter_achievement_sql_init) (void); diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index 457bf90fe..8762975e1 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -912,12 +912,18 @@ struct { struct HPMHookPoint *HP_clif_status_change_post; struct HPMHookPoint *HP_clif_insert_card_pre; struct HPMHookPoint *HP_clif_insert_card_post; - struct HPMHookPoint *HP_clif_inventorylist_pre; - struct HPMHookPoint *HP_clif_inventorylist_post; - struct HPMHookPoint *HP_clif_equiplist_pre; - struct HPMHookPoint *HP_clif_equiplist_post; - struct HPMHookPoint *HP_clif_cartlist_pre; - struct HPMHookPoint *HP_clif_cartlist_post; + struct HPMHookPoint *HP_clif_inventoryList_pre; + struct HPMHookPoint *HP_clif_inventoryList_post; + struct HPMHookPoint *HP_clif_inventoryItems_pre; + struct HPMHookPoint *HP_clif_inventoryItems_post; + struct HPMHookPoint *HP_clif_equipList_pre; + struct HPMHookPoint *HP_clif_equipList_post; + struct HPMHookPoint *HP_clif_equipItems_pre; + struct HPMHookPoint *HP_clif_equipItems_post; + struct HPMHookPoint *HP_clif_cartList_pre; + struct HPMHookPoint *HP_clif_cartList_post; + struct HPMHookPoint *HP_clif_cartItems_pre; + struct HPMHookPoint *HP_clif_cartItems_post; struct HPMHookPoint *HP_clif_favorite_item_pre; struct HPMHookPoint *HP_clif_favorite_item_post; struct HPMHookPoint *HP_clif_clearcart_pre; @@ -1212,8 +1218,16 @@ struct { struct HPMHookPoint *HP_clif_openvendingAck_post; struct HPMHookPoint *HP_clif_vendingreport_pre; struct HPMHookPoint *HP_clif_vendingreport_post; - struct HPMHookPoint *HP_clif_storagelist_pre; - struct HPMHookPoint *HP_clif_storagelist_post; + struct HPMHookPoint *HP_clif_storageList_pre; + struct HPMHookPoint *HP_clif_storageList_post; + struct HPMHookPoint *HP_clif_guildStorageList_pre; + struct HPMHookPoint *HP_clif_guildStorageList_post; + struct HPMHookPoint *HP_clif_storageItems_pre; + struct HPMHookPoint *HP_clif_storageItems_post; + struct HPMHookPoint *HP_clif_inventoryStart_pre; + struct HPMHookPoint *HP_clif_inventoryStart_post; + struct HPMHookPoint *HP_clif_inventoryEnd_pre; + struct HPMHookPoint *HP_clif_inventoryEnd_post; struct HPMHookPoint *HP_clif_updatestorageamount_pre; struct HPMHookPoint *HP_clif_updatestorageamount_post; struct HPMHookPoint *HP_clif_storageitemadded_pre; @@ -2192,6 +2206,8 @@ struct { struct HPMHookPoint *HP_clif_petEvolutionResult_post; struct HPMHookPoint *HP_clif_party_dead_notification_pre; struct HPMHookPoint *HP_clif_party_dead_notification_post; + struct HPMHookPoint *HP_clif_pMemorialDungeonCommand_pre; + struct HPMHookPoint *HP_clif_pMemorialDungeonCommand_post; struct HPMHookPoint *HP_cmdline_init_pre; struct HPMHookPoint *HP_cmdline_init_post; struct HPMHookPoint *HP_cmdline_final_pre; @@ -2686,6 +2702,8 @@ struct { struct HPMHookPoint *HP_instance_valid_post; struct HPMHookPoint *HP_instance_destroy_timer_pre; struct HPMHookPoint *HP_instance_destroy_timer_post; + struct HPMHookPoint *HP_instance_force_destroy_pre; + struct HPMHookPoint *HP_instance_force_destroy_post; struct HPMHookPoint *HP_intif_parse_pre; struct HPMHookPoint *HP_intif_parse_post; struct HPMHookPoint *HP_intif_create_pet_pre; @@ -7477,12 +7495,18 @@ struct { int HP_clif_status_change_post; int HP_clif_insert_card_pre; int HP_clif_insert_card_post; - int HP_clif_inventorylist_pre; - int HP_clif_inventorylist_post; - int HP_clif_equiplist_pre; - int HP_clif_equiplist_post; - int HP_clif_cartlist_pre; - int HP_clif_cartlist_post; + int HP_clif_inventoryList_pre; + int HP_clif_inventoryList_post; + int HP_clif_inventoryItems_pre; + int HP_clif_inventoryItems_post; + int HP_clif_equipList_pre; + int HP_clif_equipList_post; + int HP_clif_equipItems_pre; + int HP_clif_equipItems_post; + int HP_clif_cartList_pre; + int HP_clif_cartList_post; + int HP_clif_cartItems_pre; + int HP_clif_cartItems_post; int HP_clif_favorite_item_pre; int HP_clif_favorite_item_post; int HP_clif_clearcart_pre; @@ -7777,8 +7801,16 @@ struct { int HP_clif_openvendingAck_post; int HP_clif_vendingreport_pre; int HP_clif_vendingreport_post; - int HP_clif_storagelist_pre; - int HP_clif_storagelist_post; + int HP_clif_storageList_pre; + int HP_clif_storageList_post; + int HP_clif_guildStorageList_pre; + int HP_clif_guildStorageList_post; + int HP_clif_storageItems_pre; + int HP_clif_storageItems_post; + int HP_clif_inventoryStart_pre; + int HP_clif_inventoryStart_post; + int HP_clif_inventoryEnd_pre; + int HP_clif_inventoryEnd_post; int HP_clif_updatestorageamount_pre; int HP_clif_updatestorageamount_post; int HP_clif_storageitemadded_pre; @@ -8757,6 +8789,8 @@ struct { int HP_clif_petEvolutionResult_post; int HP_clif_party_dead_notification_pre; int HP_clif_party_dead_notification_post; + int HP_clif_pMemorialDungeonCommand_pre; + int HP_clif_pMemorialDungeonCommand_post; int HP_cmdline_init_pre; int HP_cmdline_init_post; int HP_cmdline_final_pre; @@ -9251,6 +9285,8 @@ struct { int HP_instance_valid_post; int HP_instance_destroy_timer_pre; int HP_instance_destroy_timer_post; + int HP_instance_force_destroy_pre; + int HP_instance_force_destroy_post; int HP_intif_parse_pre; int HP_intif_parse_post; int HP_intif_create_pet_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index 41e6f9208..2f3f1840f 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -480,9 +480,12 @@ struct HookingPointData HookingPoints[] = { { HP_POP(clif->combo_delay, HP_clif_combo_delay) }, { HP_POP(clif->status_change, HP_clif_status_change) }, { HP_POP(clif->insert_card, HP_clif_insert_card) }, - { HP_POP(clif->inventorylist, HP_clif_inventorylist) }, - { HP_POP(clif->equiplist, HP_clif_equiplist) }, - { HP_POP(clif->cartlist, HP_clif_cartlist) }, + { HP_POP(clif->inventoryList, HP_clif_inventoryList) }, + { HP_POP(clif->inventoryItems, HP_clif_inventoryItems) }, + { HP_POP(clif->equipList, HP_clif_equipList) }, + { HP_POP(clif->equipItems, HP_clif_equipItems) }, + { HP_POP(clif->cartList, HP_clif_cartList) }, + { HP_POP(clif->cartItems, HP_clif_cartItems) }, { HP_POP(clif->favorite_item, HP_clif_favorite_item) }, { HP_POP(clif->clearcart, HP_clif_clearcart) }, { HP_POP(clif->item_identify_list, HP_clif_item_identify_list) }, @@ -630,7 +633,11 @@ struct HookingPointData HookingPoints[] = { { HP_POP(clif->openvending, HP_clif_openvending) }, { HP_POP(clif->openvendingAck, HP_clif_openvendingAck) }, { HP_POP(clif->vendingreport, HP_clif_vendingreport) }, - { HP_POP(clif->storagelist, HP_clif_storagelist) }, + { HP_POP(clif->storageList, HP_clif_storageList) }, + { HP_POP(clif->guildStorageList, HP_clif_guildStorageList) }, + { HP_POP(clif->storageItems, HP_clif_storageItems) }, + { HP_POP(clif->inventoryStart, HP_clif_inventoryStart) }, + { HP_POP(clif->inventoryEnd, HP_clif_inventoryEnd) }, { HP_POP(clif->updatestorageamount, HP_clif_updatestorageamount) }, { HP_POP(clif->storageitemadded, HP_clif_storageitemadded) }, { HP_POP(clif->storageitemremoved, HP_clif_storageitemremoved) }, @@ -1120,6 +1127,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(clif->pPetEvolution, HP_clif_pPetEvolution) }, { HP_POP(clif->petEvolutionResult, HP_clif_petEvolutionResult) }, { HP_POP(clif->party_dead_notification, HP_clif_party_dead_notification) }, + { HP_POP(clif->pMemorialDungeonCommand, HP_clif_pMemorialDungeonCommand) }, /* cmdline_interface */ { HP_POP(cmdline->init, HP_cmdline_init) }, { HP_POP(cmdline->final, HP_cmdline_final) }, @@ -1379,6 +1387,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(instance->set_timeout, HP_instance_set_timeout) }, { HP_POP(instance->valid, HP_instance_valid) }, { HP_POP(instance->destroy_timer, HP_instance_destroy_timer) }, + { HP_POP(instance->force_destroy, HP_instance_force_destroy) }, /* intif_interface */ { HP_POP(intif->parse, HP_intif_parse) }, { HP_POP(intif->create_pet, HP_intif_create_pet) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 5690e0735..860e47f1b 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -11890,13 +11890,13 @@ void HP_clif_insert_card(struct map_session_data *sd, int idx_equip, int idx_car } return; } -void HP_clif_inventorylist(struct map_session_data *sd) { +void HP_clif_inventoryList(struct map_session_data *sd) { int hIndex = 0; - if (HPMHooks.count.HP_clif_inventorylist_pre > 0) { + if (HPMHooks.count.HP_clif_inventoryList_pre > 0) { void (*preHookFunc) (struct map_session_data **sd); *HPMforce_return = false; - for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_inventorylist_pre; hIndex++) { - preHookFunc = HPMHooks.list.HP_clif_inventorylist_pre[hIndex].func; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_inventoryList_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_inventoryList_pre[hIndex].func; preHookFunc(&sd); } if (*HPMforce_return) { @@ -11905,24 +11905,50 @@ void HP_clif_inventorylist(struct map_session_data *sd) { } } { - HPMHooks.source.clif.inventorylist(sd); + HPMHooks.source.clif.inventoryList(sd); } - if (HPMHooks.count.HP_clif_inventorylist_post > 0) { + if (HPMHooks.count.HP_clif_inventoryList_post > 0) { void (*postHookFunc) (struct map_session_data *sd); - for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_inventorylist_post; hIndex++) { - postHookFunc = HPMHooks.list.HP_clif_inventorylist_post[hIndex].func; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_inventoryList_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_inventoryList_post[hIndex].func; postHookFunc(sd); } } return; } -void HP_clif_equiplist(struct map_session_data *sd) { +void HP_clif_inventoryItems(struct map_session_data *sd, enum inventory_type type) { int hIndex = 0; - if (HPMHooks.count.HP_clif_equiplist_pre > 0) { + if (HPMHooks.count.HP_clif_inventoryItems_pre > 0) { + void (*preHookFunc) (struct map_session_data **sd, enum inventory_type *type); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_inventoryItems_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_inventoryItems_pre[hIndex].func; + preHookFunc(&sd, &type); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.clif.inventoryItems(sd, type); + } + if (HPMHooks.count.HP_clif_inventoryItems_post > 0) { + void (*postHookFunc) (struct map_session_data *sd, enum inventory_type type); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_inventoryItems_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_inventoryItems_post[hIndex].func; + postHookFunc(sd, type); + } + } + return; +} +void HP_clif_equipList(struct map_session_data *sd) { + int hIndex = 0; + if (HPMHooks.count.HP_clif_equipList_pre > 0) { void (*preHookFunc) (struct map_session_data **sd); *HPMforce_return = false; - for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_equiplist_pre; hIndex++) { - preHookFunc = HPMHooks.list.HP_clif_equiplist_pre[hIndex].func; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_equipList_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_equipList_pre[hIndex].func; preHookFunc(&sd); } if (*HPMforce_return) { @@ -11931,24 +11957,50 @@ void HP_clif_equiplist(struct map_session_data *sd) { } } { - HPMHooks.source.clif.equiplist(sd); + HPMHooks.source.clif.equipList(sd); } - if (HPMHooks.count.HP_clif_equiplist_post > 0) { + if (HPMHooks.count.HP_clif_equipList_post > 0) { void (*postHookFunc) (struct map_session_data *sd); - for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_equiplist_post; hIndex++) { - postHookFunc = HPMHooks.list.HP_clif_equiplist_post[hIndex].func; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_equipList_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_equipList_post[hIndex].func; postHookFunc(sd); } } return; } -void HP_clif_cartlist(struct map_session_data *sd) { +void HP_clif_equipItems(struct map_session_data *sd, enum inventory_type type) { int hIndex = 0; - if (HPMHooks.count.HP_clif_cartlist_pre > 0) { + if (HPMHooks.count.HP_clif_equipItems_pre > 0) { + void (*preHookFunc) (struct map_session_data **sd, enum inventory_type *type); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_equipItems_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_equipItems_pre[hIndex].func; + preHookFunc(&sd, &type); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.clif.equipItems(sd, type); + } + if (HPMHooks.count.HP_clif_equipItems_post > 0) { + void (*postHookFunc) (struct map_session_data *sd, enum inventory_type type); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_equipItems_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_equipItems_post[hIndex].func; + postHookFunc(sd, type); + } + } + return; +} +void HP_clif_cartList(struct map_session_data *sd) { + int hIndex = 0; + if (HPMHooks.count.HP_clif_cartList_pre > 0) { void (*preHookFunc) (struct map_session_data **sd); *HPMforce_return = false; - for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_cartlist_pre; hIndex++) { - preHookFunc = HPMHooks.list.HP_clif_cartlist_pre[hIndex].func; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_cartList_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_cartList_pre[hIndex].func; preHookFunc(&sd); } if (*HPMforce_return) { @@ -11957,17 +12009,43 @@ void HP_clif_cartlist(struct map_session_data *sd) { } } { - HPMHooks.source.clif.cartlist(sd); + HPMHooks.source.clif.cartList(sd); } - if (HPMHooks.count.HP_clif_cartlist_post > 0) { + if (HPMHooks.count.HP_clif_cartList_post > 0) { void (*postHookFunc) (struct map_session_data *sd); - for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_cartlist_post; hIndex++) { - postHookFunc = HPMHooks.list.HP_clif_cartlist_post[hIndex].func; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_cartList_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_cartList_post[hIndex].func; postHookFunc(sd); } } return; } +void HP_clif_cartItems(struct map_session_data *sd, enum inventory_type type) { + int hIndex = 0; + if (HPMHooks.count.HP_clif_cartItems_pre > 0) { + void (*preHookFunc) (struct map_session_data **sd, enum inventory_type *type); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_cartItems_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_cartItems_pre[hIndex].func; + preHookFunc(&sd, &type); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.clif.cartItems(sd, type); + } + if (HPMHooks.count.HP_clif_cartItems_post > 0) { + void (*postHookFunc) (struct map_session_data *sd, enum inventory_type type); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_cartItems_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_cartItems_post[hIndex].func; + postHookFunc(sd, type); + } + } + return; +} void HP_clif_favorite_item(struct map_session_data *sd, unsigned short index) { int hIndex = 0; if (HPMHooks.count.HP_clif_favorite_item_pre > 0) { @@ -15809,13 +15887,39 @@ void HP_clif_vendingreport(struct map_session_data *sd, int index, int amount, u } return; } -void HP_clif_storagelist(struct map_session_data *sd, struct item *items, int items_length) { +void HP_clif_storageList(struct map_session_data *sd, struct item *items, int items_length) { + int hIndex = 0; + if (HPMHooks.count.HP_clif_storageList_pre > 0) { + void (*preHookFunc) (struct map_session_data **sd, struct item **items, int *items_length); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_storageList_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_storageList_pre[hIndex].func; + preHookFunc(&sd, &items, &items_length); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.clif.storageList(sd, items, items_length); + } + if (HPMHooks.count.HP_clif_storageList_post > 0) { + void (*postHookFunc) (struct map_session_data *sd, struct item *items, int items_length); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_storageList_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_storageList_post[hIndex].func; + postHookFunc(sd, items, items_length); + } + } + return; +} +void HP_clif_guildStorageList(struct map_session_data *sd, struct item *items, int items_length) { int hIndex = 0; - if (HPMHooks.count.HP_clif_storagelist_pre > 0) { + if (HPMHooks.count.HP_clif_guildStorageList_pre > 0) { void (*preHookFunc) (struct map_session_data **sd, struct item **items, int *items_length); *HPMforce_return = false; - for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_storagelist_pre; hIndex++) { - preHookFunc = HPMHooks.list.HP_clif_storagelist_pre[hIndex].func; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_guildStorageList_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_guildStorageList_pre[hIndex].func; preHookFunc(&sd, &items, &items_length); } if (*HPMforce_return) { @@ -15824,17 +15928,95 @@ void HP_clif_storagelist(struct map_session_data *sd, struct item *items, int it } } { - HPMHooks.source.clif.storagelist(sd, items, items_length); + HPMHooks.source.clif.guildStorageList(sd, items, items_length); } - if (HPMHooks.count.HP_clif_storagelist_post > 0) { + if (HPMHooks.count.HP_clif_guildStorageList_post > 0) { void (*postHookFunc) (struct map_session_data *sd, struct item *items, int items_length); - for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_storagelist_post; hIndex++) { - postHookFunc = HPMHooks.list.HP_clif_storagelist_post[hIndex].func; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_guildStorageList_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_guildStorageList_post[hIndex].func; postHookFunc(sd, items, items_length); } } return; } +void HP_clif_storageItems(struct map_session_data *sd, enum inventory_type type, struct item *items, int items_length) { + int hIndex = 0; + if (HPMHooks.count.HP_clif_storageItems_pre > 0) { + void (*preHookFunc) (struct map_session_data **sd, enum inventory_type *type, struct item **items, int *items_length); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_storageItems_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_storageItems_pre[hIndex].func; + preHookFunc(&sd, &type, &items, &items_length); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.clif.storageItems(sd, type, items, items_length); + } + if (HPMHooks.count.HP_clif_storageItems_post > 0) { + void (*postHookFunc) (struct map_session_data *sd, enum inventory_type type, struct item *items, int items_length); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_storageItems_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_storageItems_post[hIndex].func; + postHookFunc(sd, type, items, items_length); + } + } + return; +} +void HP_clif_inventoryStart(struct map_session_data *sd, enum inventory_type type, const char *name) { + int hIndex = 0; + if (HPMHooks.count.HP_clif_inventoryStart_pre > 0) { + void (*preHookFunc) (struct map_session_data **sd, enum inventory_type *type, const char **name); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_inventoryStart_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_inventoryStart_pre[hIndex].func; + preHookFunc(&sd, &type, &name); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.clif.inventoryStart(sd, type, name); + } + if (HPMHooks.count.HP_clif_inventoryStart_post > 0) { + void (*postHookFunc) (struct map_session_data *sd, enum inventory_type type, const char *name); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_inventoryStart_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_inventoryStart_post[hIndex].func; + postHookFunc(sd, type, name); + } + } + return; +} +void HP_clif_inventoryEnd(struct map_session_data *sd, enum inventory_type type) { + int hIndex = 0; + if (HPMHooks.count.HP_clif_inventoryEnd_pre > 0) { + void (*preHookFunc) (struct map_session_data **sd, enum inventory_type *type); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_inventoryEnd_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_inventoryEnd_pre[hIndex].func; + preHookFunc(&sd, &type); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.clif.inventoryEnd(sd, type); + } + if (HPMHooks.count.HP_clif_inventoryEnd_post > 0) { + void (*postHookFunc) (struct map_session_data *sd, enum inventory_type type); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_inventoryEnd_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_inventoryEnd_post[hIndex].func; + postHookFunc(sd, type); + } + } + return; +} void HP_clif_updatestorageamount(struct map_session_data *sd, int amount, int max_amount) { int hIndex = 0; if (HPMHooks.count.HP_clif_updatestorageamount_pre > 0) { @@ -28574,6 +28756,32 @@ void HP_clif_party_dead_notification(struct map_session_data *sd) { } return; } +void HP_clif_pMemorialDungeonCommand(int fd, struct map_session_data *sd) { + int hIndex = 0; + if (HPMHooks.count.HP_clif_pMemorialDungeonCommand_pre > 0) { + void (*preHookFunc) (int *fd, struct map_session_data **sd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_pMemorialDungeonCommand_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_pMemorialDungeonCommand_pre[hIndex].func; + preHookFunc(&fd, &sd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.clif.pMemorialDungeonCommand(fd, sd); + } + if (HPMHooks.count.HP_clif_pMemorialDungeonCommand_post > 0) { + void (*postHookFunc) (int fd, struct map_session_data *sd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_pMemorialDungeonCommand_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_pMemorialDungeonCommand_post[hIndex].func; + postHookFunc(fd, sd); + } + } + return; +} /* cmdline_interface */ void HP_cmdline_init(void) { int hIndex = 0; @@ -35268,6 +35476,32 @@ int HP_instance_destroy_timer(int tid, int64 tick, int id, intptr_t data) { } return retVal___; } +void HP_instance_force_destroy(struct map_session_data *sd) { + int hIndex = 0; + if (HPMHooks.count.HP_instance_force_destroy_pre > 0) { + void (*preHookFunc) (struct map_session_data **sd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_instance_force_destroy_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_instance_force_destroy_pre[hIndex].func; + preHookFunc(&sd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.instance.force_destroy(sd); + } + if (HPMHooks.count.HP_instance_force_destroy_post > 0) { + void (*postHookFunc) (struct map_session_data *sd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_instance_force_destroy_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_instance_force_destroy_post[hIndex].func; + postHookFunc(sd); + } + } + return; +} /* intif_interface */ int HP_intif_parse(int fd) { int hIndex = 0; diff --git a/src/plugins/db2sql.c b/src/plugins/db2sql.c index 57e68432e..2ece501b2 100644 --- a/src/plugins/db2sql.c +++ b/src/plugins/db2sql.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2013-2015 Hercules Dev Team + * Copyright (C) 2013-2018 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 @@ -70,6 +70,10 @@ bool mobdb2sql_torun = false; int (*itemdb_readdb_libconfig_sub) (struct config_setting_t *it, int n, const char *source); /// Backup of the original mob_db parser function pointer. int (*mob_read_db_sub) (struct config_setting_t *it, int n, const char *source); +bool (*mob_skill_db_libconfig_sub_skill) (struct config_setting_t *it, int n, int mob_id); + +// +void do_mobskilldb2sql(void); /** * Normalizes and appends a string to the output buffer. @@ -811,6 +815,330 @@ void do_mobdb2sql(void) if (tosql.buf[i].p) aFree(tosql.buf[i].p); } + + // Run mob_skill_db converter + do_mobskilldb2sql(); +} + +/** + * Converts Mob Skill State constant to string + */ +const char* mob_skill_state_tostring(enum MobSkillState mss) +{ + switch(mss) { + case MSS_ANY: + return "any"; + case MSS_IDLE: + return "idle"; + case MSS_WALK: + return "walk"; + case MSS_LOOT: + return "loot"; + case MSS_DEAD: + return "dead"; + case MSS_BERSERK: + return "attack"; + case MSS_ANGRY: + return "angry"; + case MSS_RUSH: + return "chase"; + case MSS_FOLLOW: + return "follow"; + case MSS_ANYTARGET: + return "anytarget"; + } + + return "unknown"; +} + +/** + * Converts Mob Skill Target constant to string + */ +const char* mob_skill_target_tostring(int target) +{ + switch(target) { + case MST_TARGET: + return "target"; + case MST_RANDOM: + return "randomtarget"; + case MST_SELF: + return "self"; + case MST_FRIEND: + return "friend"; + case MST_MASTER: + return "master"; + case MST_AROUND1: + return "around1"; + case MST_AROUND2: + return "around2"; + case MST_AROUND3: + return "around3"; + //case MST_AROUND: // same value as MST_AROUND4 + case MST_AROUND4: + return "around4"; + case MST_AROUND5: + return "around5"; + case MST_AROUND6: + return "around6"; + case MST_AROUND7: + return "around7"; + case MST_AROUND8: + return "around8"; + } + return "unknown"; +} + +/** + * Converts Mob Skill Condition constant to string + */ +const char* mob_skill_condition_tostring(int condition) +{ + switch(condition) { + case MSC_ALWAYS: + return "always"; + case MSC_MYHPLTMAXRATE: + return "myhpltmaxrate"; + case MSC_MYHPINRATE: + return "myhpinrate"; + case MSC_FRIENDHPLTMAXRATE: + return "friendhpltmaxrate"; + case MSC_FRIENDHPINRATE: + return "friendhpinrate"; + case MSC_MYSTATUSON: + return "mystatuson"; + case MSC_MYSTATUSOFF: + return "mystatusoff"; + case MSC_FRIENDSTATUSON: + return "friendstatuson"; + case MSC_FRIENDSTATUSOFF: + return "friendstatusoff"; + case MSC_ATTACKPCGT: + return "attackpcgt"; + case MSC_ATTACKPCGE: + return "attackpcge"; + case MSC_SLAVELT: + return "slavelt"; + case MSC_SLAVELE: + return "slavele"; + case MSC_CLOSEDATTACKED: + return "closedattacked"; + case MSC_LONGRANGEATTACKED: + return "longrangeattacked"; + case MSC_AFTERSKILL: + return "afterskill"; + case MSC_SKILLUSED: + return "skillused"; + case MSC_CASTTARGETED: + return "casttargeted"; + case MSC_RUDEATTACKED: + return "rudeattacked"; + case MSC_MASTERHPLTMAXRATE: + return "masterhpltmaxrate"; + case MSC_MASTERATTACKED: + return "masterattacked"; + case MSC_ALCHEMIST: + return "alchemist"; + case MSC_SPAWN: + return "onspawn"; + } + return "unknown"; +} + +/** + * Converts a Mob Skill DB entry to SQL. + * + * @see mob_skill_db_libconfig_sub_skill. + */ +bool mobskilldb2sql_sub(struct config_setting_t *it, int n, int mob_id) +{ + int i32 = 0, i; + StringBuf buf; + struct mob_db *md = mob->db(mob_id); + char valname[15]; + const char *name = config_setting_name(it); + + nullpo_retr(false, it); + Assert_retr(false, mob_id <= 0 || md != mob->dummy); + + StrBuf->Init(&buf); + + // MonsterID + StrBuf->Printf(&buf, "%d,", mob_id); + + // Info + StrBuf->Printf(&buf, "'%s@%s',", md->name, name); + + if (mob->lookup_const(it, "SkillState", &i32) && (i32 < MSS_ANY || i32 > MSS_ANYTARGET)) { + ShowWarning("mob_skill_db_libconfig_sub_skill: Invalid skill state %d for skill '%s' in monster %d, defaulting to MSS_ANY.\n", i32, name, mob_id); + i32 = MSS_ANY; + } + // State + StrBuf->Printf(&buf, "'%s',", mob_skill_state_tostring(i32)); + + // SkillID + if (!(i32 = skill->name2id(name))) { + ShowWarning("mob_skill_db_libconfig_sub_skill: Non existant skill id %d in monster %d, skipping.\n", i32, mob_id); + return false; + } + StrBuf->Printf(&buf, "%d,", i32); + + // SkillLv + if (!libconfig->setting_lookup_int(it, "SkillLevel", &i32) || i32 <= 0) + i32 = 1; + StrBuf->Printf(&buf, "%d,", i32); + + // Rate + i32 = 0; + libconfig->setting_lookup_int(it, "Rate", &i32); + StrBuf->Printf(&buf, "%d,", i32); + + // CastTime + i32 = 0; + libconfig->setting_lookup_int(it, "CastTime", &i32); + StrBuf->Printf(&buf, "%d,", i32); + + // Delay + i32 = 0; + libconfig->setting_lookup_int(it, "Delay", &i32); + StrBuf->Printf(&buf, "%d,", i32); + + // Cancelable + if (libconfig->setting_lookup_bool(it, "Cancelable", &i32)) { + StrBuf->Printf(&buf, "'%s',", ((i32 == 0) ? "no" : "yes")); + } else { + StrBuf->Printf(&buf, "'no',"); + } + + // Target + if (mob->lookup_const(it, "SkillTarget", &i32) && (i32 < MST_TARGET || i32 > MST_AROUND)) { + i32 = MST_TARGET; + } + StrBuf->Printf(&buf, "'%s',", mob_skill_target_tostring(i32)); + + // Condition + if (mob->lookup_const(it, "CastCondition", &i32) && (i32 < MSC_ALWAYS || i32 > MSC_SPAWN)) { + i32 = MSC_ALWAYS; + } + StrBuf->Printf(&buf, "'%s',", mob_skill_condition_tostring(i32)); + + // ConditionValue + i32 = 0; + if (mob->lookup_const(it, "ConditionData", &i32)) { + StrBuf->Printf(&buf, "'%d',", i32); + } else { + StrBuf->Printf(&buf, "NULL,"); + } + + // Val1-Val5 + for (i = 0; i < 5; i++) { + sprintf(valname, "val%1d", i); + if (libconfig->setting_lookup_int(it, valname, &i32)) { + StrBuf->Printf(&buf, "%d,", i32); + } else { + StrBuf->Printf(&buf, "NULL,"); + } + } + + // Emotion + if (libconfig->setting_lookup_int(it, "Emotion", &i32)) { + StrBuf->Printf(&buf, "'%d',", i32); + } else { + StrBuf->Printf(&buf, "NULL,"); + } + + if (libconfig->setting_lookup_int(it, "ChatMsgID", &i32) && i32 > 0 && i32 <= MAX_MOB_CHAT) { + StrBuf->Printf(&buf, "'%d'", i32); + } else { + StrBuf->Printf(&buf, "NULL"); + } + + fprintf(tosql.fp, "REPLACE INTO `%s` VALUES (%s);\n", tosql.db_name, StrBuf->Value(&buf)); + + StrBuf->Destroy(&buf); + + return true; + +} + + +/** + * Prints a SQL table header for the current mob_skill_db table. + */ +void mobskilldb2sql_tableheader(void) +{ + db2sql_fileheader(); + + fprintf(tosql.fp, + "--\n" + "-- Table structure for table `%s`\n" + "--\n" + "\n" + "DROP TABLE IF EXISTS `%s`;\n" + "CREATE TABLE `%s` (\n" + " `MOB_ID` SMALLINT(6) NOT NULL,\n" + " `INFO` TEXT NOT NULL,\n" + " `STATE` TEXT NOT NULL,\n" + " `SKILL_ID` SMALLINT(6) NOT NULL,\n" + " `SKILL_LV` TINYINT(4) NOT NULL,\n" + " `RATE` SMALLINT(4) NOT NULL,\n" + " `CASTTIME` MEDIUMINT(9) NOT NULL,\n" + " `DELAY` INT(9) NOT NULL,\n" + " `CANCELABLE` TEXT NOT NULL,\n" + " `TARGET` TEXT NOT NULL,\n" + " `CONDITION` TEXT NOT NULL,\n" + " `CONDITION_VALUE` TEXT,\n" + " `VAL1` INT(11) DEFAULT NULL,\n" + " `VAL2` INT(11) DEFAULT NULL,\n" + " `VAL3` INT(11) DEFAULT NULL,\n" + " `VAL4` INT(11) DEFAULT NULL,\n" + " `VAL5` INT(11) DEFAULT NULL,\n" + " `EMOTION` TEXT,\n" + " `CHAT` TEXT\n" + ") ENGINE=MyISAM;\n" + "\n", tosql.db_name, tosql.db_name, tosql.db_name); +} + +/** + * Mob Skill DB Conversion + */ +void do_mobskilldb2sql(void) +{ + int i; + struct convert_db_files { + const char *name; + const char *source; + const char *destination; + } files[] = { + {"mob_skill_db", DBPATH"mob_skill_db.conf", "sql-files/mob_skill_db" DBSUFFIX ".sql"}, + {"mob_skill_db2", "mob_skill_db2.conf", "sql-files/mob_skill_db2.sql"}, + }; + + /* link */ + mob_skill_db_libconfig_sub_skill = mob->skill_db_libconfig_sub_skill; + mob->skill_db_libconfig_sub_skill = mobskilldb2sql_sub; + + memset(&tosql.buf, 0, sizeof(tosql.buf)); + for (i = 0; i < ARRAYLENGTH(files); i++) { + if ((tosql.fp = fopen(files[i].destination, "wt+")) == NULL) { + ShowError("do_mobskilldb2sql: File not found \"%s\".\n", files[i].destination); + return; + } + + tosql.db_name = files[i].name; + mobskilldb2sql_tableheader(); + + mob->skill_db_libconfig(files[i].source, false); + + fclose(tosql.fp); + } + + /* unlink */ + mob->skill_db_libconfig_sub_skill = mob_skill_db_libconfig_sub_skill; + + for (i = 0; i < ARRAYLENGTH(tosql.buf); i++) { + if (tosql.buf[i].p) + aFree(tosql.buf[i].p); + } } /** |