From fce05b62b79221fbed2f64d8d32d6f97cee8b00f Mon Sep 17 00:00:00 2001 From: Asheraf Date: Sat, 23 Dec 2017 01:32:35 +0000 Subject: Add support for new drop packet 0xadd for zero clients --- src/map/atcommand.c | 2 +- src/map/clif.c | 10 +++++++++- src/map/itemdb.c | 6 ++++++ src/map/itemdb.h | 4 ++++ src/map/map.c | 4 +++- src/map/map.h | 3 ++- src/map/mob.c | 4 ++-- src/map/packets_struct.h | 8 +++++++- src/map/pc.c | 4 ++-- src/map/pet.c | 8 ++++---- src/map/script.c | 14 +++++++------- src/map/skill.c | 20 ++++++++++---------- 12 files changed, 57 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 1590c3f0c..aa25f11d6 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -5457,7 +5457,7 @@ void atcommand_getring(struct map_session_data* sd) { if((flag = pc->additem(sd,&item_tmp,1,LOG_TYPE_COMMAND))) { clif->additem(sd,0,0,flag); - map->addflooritem(&sd->bl, &item_tmp, 1, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); + map->addflooritem(&sd->bl, &item_tmp, 1, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0, false); } } diff --git a/src/map/clif.c b/src/map/clif.c index 7edc1ec5a..6629eb500 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -796,7 +796,15 @@ void clif_dropflooritem(struct flooritem_data* fitem) { p.subX = fitem->subx; p.subY = fitem->suby; p.count = fitem->item_data.amount; - +#ifdef PACKETVER_ZERO + if (fitem->showdropeffect) { + p.showdropeffect = itemdb_showdropeffect(fitem->item_data.nameid); + p.dropeffectmode = itemdb_dropeffectmode(fitem->item_data.nameid); + } else { + p.showdropeffect = 0; + p.dropeffectmode = 0; + } +#endif clif->send(&p, sizeof(p), &fitem->bl, AREA); } diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 7fedb19ae..17a73400a 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -2070,6 +2070,12 @@ int itemdb_readdb_libconfig_sub(struct config_setting_t *it, int n, const char * if ((t = libconfig->setting_get_member(it, "DisableOptions"))) id.flag.no_options = libconfig->setting_get_bool(t) ? 1 : 0; + if ((t = libconfig->setting_get_member(it, "ShowDropEffect"))) + id.flag.showdropeffect = libconfig->setting_get_bool(t) ? 1 : 0; + + if (itemdb->lookup_const(it, "DropEffectMode", &i32) && i32 >= 0) + id.dropeffectmode = i32; + if (itemdb->lookup_const(it, "ViewSprite", &i32) && i32 >= 0) id.view_sprite = i32; diff --git a/src/map/itemdb.h b/src/map/itemdb.h index d2d3b6c73..5344a7cd6 100644 --- a/src/map/itemdb.h +++ b/src/map/itemdb.h @@ -472,6 +472,7 @@ struct item_data { int view_id; int matk; int elvmax;/* maximum level for this item */ + int dropeffectmode; int delay; uint64 class_base[3]; ///< Specifies if the base can wear this item (split in 3 indexes per type: 1-1, 2-1, 2-2) @@ -495,6 +496,7 @@ struct item_data { unsigned force_serial : 1; unsigned no_options: 1; // < disallows use of item options on the item. (non-equippable items are automatically flagged) [Smokexyz] unsigned drop_announce : 1; // Official Drop Announce [Jedzkie] + unsigned showdropeffect: 1; // < Allow showing effect on item drop [Asheraf] } flag; struct {// item stacking limitation unsigned short amount; @@ -538,6 +540,8 @@ struct item_data { #define itemdb_value_sell(n) (itemdb->search(n)->value_sell) #define itemdb_canrefine(n) (!itemdb->search(n)->flag.no_refine) #define itemdb_allowoption(n) (!itemdb->search(n)->flag.no_options) +#define itemdb_showdropeffect(n) (itemdb->search(n)->flag.showdropeffect) +#define itemdb_dropeffectmode(n) (itemdb->search(n)->dropeffectmode) #define itemdb_is_element(n) ((n) >= ITEMID_SCARLET_PTS && (n) <= ITEMID_LIME_GREEN_PTS) #define itemdb_is_spellbook(n) ((n) >= ITEMID_MAGIC_BOOK_FB && (n) <= ITEMID_MAGIC_BOOK_DL) diff --git a/src/map/map.c b/src/map/map.c index 5a647625f..306f3a99d 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -1694,8 +1694,9 @@ bool map_closest_freecell(int16 m, const struct block_list *bl, int16 *x, int16 * @m, @x, @y mapid,x,y * @first_charid, @second_charid, @third_charid, looting priority * @flag: &1 MVP item. &2 do stacking check. + * @showdropeffect: show effect when the item is dropped. *------------------------------------------*/ -int map_addflooritem(const struct block_list *bl, struct item *item_data, int amount, int16 m, int16 x, int16 y, int first_charid, int second_charid, int third_charid, int flags) +int map_addflooritem(const struct block_list *bl, struct item *item_data, int amount, int16 m, int16 x, int16 y, int first_charid, int second_charid, int third_charid, int flags, bool showdropeffect) { int r; struct flooritem_data *fitem=NULL; @@ -1714,6 +1715,7 @@ int map_addflooritem(const struct block_list *bl, struct item *item_data, int am fitem->bl.x = x; fitem->bl.y = y; fitem->bl.id = map->get_new_object_id(); + fitem->showdropeffect = showdropeffect; if(fitem->bl.id==0){ ers_free(map->flooritem_ers, fitem); return 0; diff --git a/src/map/map.h b/src/map/map.h index 5835b5abc..fab8839d8 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -531,6 +531,7 @@ struct flooritem_data { int first_get_charid,second_get_charid,third_get_charid; int64 first_get_tick,second_get_tick,third_get_tick; struct item item_data; + bool showdropeffect; }; enum status_point_types { //we better clean up this enum and change it name [Hemagx] @@ -1208,7 +1209,7 @@ END_ZEROED_BLOCK; int (*clearflooritem_timer) (int tid, int64 tick, int id, intptr_t data); int (*removemobs_timer) (int tid, int64 tick, int id, intptr_t data); void (*clearflooritem) (struct block_list* bl); - int (*addflooritem) (const struct block_list *bl, struct item *item_data, int amount, int16 m, int16 x, int16 y, int first_charid, int second_charid, int third_charid, int flags); + int (*addflooritem) (const struct block_list *bl, struct item *item_data, int amount, int16 m, int16 x, int16 y, int first_charid, int second_charid, int third_charid, int flags, bool showdropeffect); // player to map session void (*addnickdb) (int charid, const char* nick); void (*delnickdb) (int charid, const char* nick); diff --git a/src/map/mob.c b/src/map/mob.c index f509ecace..e1c145d43 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -1873,7 +1873,7 @@ int mob_delay_item_drop(int tid, int64 tick, int id, intptr_t data) { struct item_drop *ditem_prev; map->addflooritem(NULL, &ditem->item_data,ditem->item_data.amount, list->m,list->x,list->y, - list->first_charid,list->second_charid,list->third_charid,0); + list->first_charid,list->second_charid,list->third_charid,0,true); ditem_prev = ditem; ditem = ditem->next; ers_free(item_drop_ers, ditem_prev); @@ -2586,7 +2586,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) { if((temp = pc->additem(mvp_sd,&item,1,LOG_TYPE_PICKDROP_PLAYER)) != 0) { clif->additem(mvp_sd,0,0,temp); - map->addflooritem(&md->bl, &item, 1, mvp_sd->bl.m, mvp_sd->bl.x, mvp_sd->bl.y, mvp_sd->status.char_id, (second_sd?second_sd->status.char_id : 0), (third_sd ? third_sd->status.char_id : 0), 1); + map->addflooritem(&md->bl, &item, 1, mvp_sd->bl.m, mvp_sd->bl.x, mvp_sd->bl.y, mvp_sd->status.char_id, (second_sd?second_sd->status.char_id : 0), (third_sd ? third_sd->status.char_id : 0), 1, true); } //Logs items, MVP prizes [Lupus] diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index e1395e949..f253b8906 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -191,7 +191,9 @@ enum packet_headers { skill_entryType = 0x9ca, #endif graffiti_entryType = 0x1c9, -#if PACKETVER > 20130000 /* not sure date */ +#ifdef PACKETVER_ZERO + dropflooritemType = 0xadd, +#elif PACKETVER > 20130000 /* not sure date */ dropflooritemType = 0x84b, #else dropflooritemType = 0x9e, @@ -495,6 +497,10 @@ struct packet_dropflooritem { uint8 subX; uint8 subY; int16 count; +#ifdef PACKETVER_ZERO + int8 showdropeffect; + int16 dropeffectmode; +#endif } __attribute__((packed)); struct packet_idle_unit2 { #if PACKETVER < 20091103 diff --git a/src/map/pc.c b/src/map/pc.c index d5d359557..449cb25d3 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -4781,7 +4781,7 @@ int pc_dropitem(struct map_session_data *sd,int n,int amount) return 0; } - if (!map->addflooritem(&sd->bl, &sd->status.inventory[n], amount, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 2)) + if (!map->addflooritem(&sd->bl, &sd->status.inventory[n], amount, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 2, false)) return 0; pc->delitem(sd, n, amount, 1, DELITEM_NORMAL, LOG_TYPE_PICKDROP_PLAYER); @@ -7962,7 +7962,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) { item_tmp.card[1]=0; item_tmp.card[2]=GetWord(sd->status.char_id,0); // CharId item_tmp.card[3]=GetWord(sd->status.char_id,1); - map->addflooritem(&sd->bl, &item_tmp, 1, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); + map->addflooritem(&sd->bl, &item_tmp, 1, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0, false); } // activate Steel body if a super novice dies at 99+% exp [celest] diff --git a/src/map/pet.c b/src/map/pet.c index 9ac496659..2997a4b5a 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -325,7 +325,7 @@ int pet_return_egg(struct map_session_data *sd, struct pet_data *pd) tmp_item.card[3] = pd->pet.rename_flag; if((flag = pc->additem(sd,&tmp_item,1,LOG_TYPE_EGG))) { clif->additem(sd,0,0,flag); - map->addflooritem(&sd->bl, &tmp_item, 1, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); + map->addflooritem(&sd->bl, &tmp_item, 1, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0, false); } pd->pet.incubate = 1; unit->free(&pd->bl,CLR_OUTSIGHT); @@ -610,7 +610,7 @@ bool pet_get_egg(int account_id, short pet_class, int pet_id ) { tmp_item.card[3] = 0; //New pets are not named. if((ret = pc->additem(sd,&tmp_item,1,LOG_TYPE_PICKDROP_PLAYER))) { clif->additem(sd,0,0,ret); - map->addflooritem(&sd->bl, &tmp_item, 1, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); + map->addflooritem(&sd->bl, &tmp_item, 1, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0, false); } return true; @@ -751,7 +751,7 @@ int pet_unequipitem(struct map_session_data *sd, struct pet_data *pd) { tmp_item.identify = 1; if((flag = pc->additem(sd,&tmp_item,1,LOG_TYPE_CONSUME))) { clif->additem(sd,0,0,flag); - map->addflooritem(&sd->bl, &tmp_item, 1, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); + map->addflooritem(&sd->bl, &tmp_item, 1, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0, false); } if( battle_config.pet_equip_required ) { // Skotlex: halt support timers if needed @@ -1026,7 +1026,7 @@ int pet_delay_item_drop(int tid, int64 tick, int id, intptr_t data) { struct item_drop *ditem_prev; map->addflooritem(NULL, &ditem->item_data, ditem->item_data.amount, list->m, list->x, list->y, - list->first_charid, list->second_charid, list->third_charid, 0); + list->first_charid, list->second_charid, list->third_charid, 0, false); ditem_prev = ditem; ditem = ditem->next; ers_free(pet->item_drop_ers, ditem_prev); diff --git a/src/map/script.c b/src/map/script.c index 7f7aba183..d5a0e4864 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -7923,7 +7923,7 @@ BUILDIN(getitem) { if ((flag = pc->additem(sd, &it, get_count, LOG_TYPE_SCRIPT))) { clif->additem(sd, 0, 0, flag); if( pc->candrop(sd,&it) ) - map->addflooritem(&sd->bl, &it, get_count, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); + map->addflooritem(&sd->bl, &it, get_count, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0, false); } } } @@ -8031,7 +8031,7 @@ BUILDIN(getitem2) if ((flag = pc->additem(sd, &item_tmp, get_count, LOG_TYPE_SCRIPT))) { clif->additem(sd, 0, 0, flag); if( pc->candrop(sd,&item_tmp) ) - map->addflooritem(&sd->bl, &item_tmp, get_count, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); + map->addflooritem(&sd->bl, &item_tmp, get_count, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0, false); } } } @@ -8224,7 +8224,7 @@ BUILDIN(makeitem) item_tmp.nameid = nameid; item_tmp.identify=1; - map->addflooritem(NULL, &item_tmp, amount, m, x, y, 0, 0, 0, 0); + map->addflooritem(NULL, &item_tmp, amount, m, x, y, 0, 0, 0, 0, false); return true; } @@ -8308,7 +8308,7 @@ BUILDIN(makeitem2) item_tmp.card[2] = (short)script_getnum(st, 9); item_tmp.card[3] = (short)script_getnum(st, 10); - map->addflooritem(NULL, &item_tmp, amount, m, x, y, 0, 0, 0, 0); + map->addflooritem(NULL, &item_tmp, amount, m, x, y, 0, 0, 0, 0, false); return true; } @@ -13576,7 +13576,7 @@ BUILDIN(successremovecards) if ((flag = pc->additem(sd, &item_tmp, 1, LOG_TYPE_SCRIPT))) { clif->additem(sd, 0, 0, flag); - map->addflooritem(&sd->bl, &item_tmp, 1, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); + map->addflooritem(&sd->bl, &item_tmp, 1, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0, false); } } } @@ -13634,7 +13634,7 @@ BUILDIN(failedremovecards) if ((flag = pc->additem(sd, &item_tmp, 1, LOG_TYPE_SCRIPT))) { clif->additem(sd, 0, 0, flag); - map->addflooritem(&sd->bl, &item_tmp, 1, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); + map->addflooritem(&sd->bl, &item_tmp, 1, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0, false); } } } @@ -22171,7 +22171,7 @@ BUILDIN(getrandgroupitem) if ((flag = pc->additem(sd, &it, get_count, LOG_TYPE_SCRIPT))) { clif->additem(sd, 0, 0, flag); if( pc->candrop(sd,&it) ) - map->addflooritem(&sd->bl, &it, get_count, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); + map->addflooritem(&sd->bl, &it, get_count, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0, false); } } } diff --git a/src/map/skill.c b/src/map/skill.c index 88a29b9a8..25ea0a8ba 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -5207,7 +5207,7 @@ int skill_castend_damage_id(struct block_list* src, struct block_list *bl, uint1 item_tmp.nameid = sg->item_id ? sg->item_id : ITEMID_BOOBY_TRAP; item_tmp.identify = 1; if( item_tmp.nameid ) - map->addflooritem(bl, &item_tmp, 1, bl->m, bl->x, bl->y, 0, 0, 0, 0); + map->addflooritem(bl, &item_tmp, 1, bl->m, bl->x, bl->y, 0, 0, 0, 0, false); } skill->delunit(su); } @@ -7452,7 +7452,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin eflag = pc->additem(sd,&item_tmp,1,LOG_TYPE_PRODUCE); if(eflag) { clif->additem(sd,0,0,eflag); - map->addflooritem(&sd->bl, &item_tmp, 1, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); + map->addflooritem(&sd->bl, &item_tmp, 1, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0, false); } } break; @@ -8176,7 +8176,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin item_tmp.identify = 1; if ((success = pc->additem(sd, &item_tmp, amount, LOG_TYPE_SKILL)) != 0) { clif->additem(sd,0,0,success); - map->addflooritem(&sd->bl, &item_tmp, amount, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); + map->addflooritem(&sd->bl, &item_tmp, amount, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0, false); } } } @@ -8188,7 +8188,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin item_tmp.identify = 1; if (item_tmp.nameid && (flag=pc->additem(sd,&item_tmp,1,LOG_TYPE_SKILL)) != 0) { clif->additem(sd,0,0,flag); - map->addflooritem(&sd->bl, &item_tmp, 1, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); + map->addflooritem(&sd->bl, &item_tmp, 1, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0, false); } } } @@ -17502,7 +17502,7 @@ int skill_unit_timer_sub(union DBKey key, struct DBData *data, va_list ap) memset(&item_tmp,0,sizeof(item_tmp)); item_tmp.nameid = group->item_id ? group->item_id : ITEMID_BOOBY_TRAP; item_tmp.identify = 1; - map->addflooritem(bl, &item_tmp, 1, bl->m, bl->x, bl->y, 0, 0, 0, 0); + map->addflooritem(bl, &item_tmp, 1, bl->m, bl->x, bl->y, 0, 0, 0, 0, false); } skill->delunit(su); } @@ -18457,7 +18457,7 @@ int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid, tmp_item.amount = qty * skill->dbs->changematerial_db[i].qty[j]; if((flag = pc->additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE))) { clif->additem(sd,0,0,flag); - map->addflooritem(&sd->bl, &tmp_item, tmp_item.amount, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); + map->addflooritem(&sd->bl, &tmp_item, tmp_item.amount, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0, false); } k++; } @@ -18471,7 +18471,7 @@ int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid, } else if (tmp_item.amount) { //Success if((flag = pc->additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE))) { clif->additem(sd,0,0,flag); - map->addflooritem(&sd->bl, &tmp_item, tmp_item.amount, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); + map->addflooritem(&sd->bl, &tmp_item, tmp_item.amount, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0, false); } if( skill_id == GN_MIX_COOKING || skill_id == GN_MAKEBOMB || skill_id == GN_S_PHARMACY ) clif->msgtable_skill(sd, skill_id, MSG_SKILL_SUCCESS); @@ -18531,7 +18531,7 @@ int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid, tmp_item.identify = 1; if( pc->additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE) ) { clif->additem(sd,0,0,flag); - map->addflooritem(&sd->bl, &tmp_item, tmp_item.amount, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); + map->addflooritem(&sd->bl, &tmp_item, tmp_item.amount, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0, false); } clif->msgtable_skill(sd, skill_id, MSG_SKILL_FAILURE); } @@ -18588,7 +18588,7 @@ int skill_arrow_create (struct map_session_data *sd, int nameid) continue; if((flag = pc->additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE))) { clif->additem(sd,0,0,flag); - map->addflooritem(&sd->bl, &tmp_item, tmp_item.amount, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); + map->addflooritem(&sd->bl, &tmp_item, tmp_item.amount, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0, false); } } @@ -18843,7 +18843,7 @@ int skill_elementalanalysis(struct map_session_data *sd, uint16 skill_lv, const int flag = pc->additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_CONSUME); if (flag) { clif->additem(sd,0,0,flag); - map->addflooritem(&sd->bl, &tmp_item, tmp_item.amount, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); + map->addflooritem(&sd->bl, &tmp_item, tmp_item.amount, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0, false); } } -- cgit v1.2.3-60-g2f50