Fixes item production with high item IDs (#5315)

* Fixes #5312.
* Fixes general item production skills not consuming catalyst items with high IDs.
* Adjusts item searching functions to use t_itemid instead of uint32.
* Adjusts script command makeitem2 to use t_itemid isntead of uint32.
* Fixes output and lookups for atcommands idsearch, autolootitem, iteminfo, whodrops, makeegg, and itemlist.
* Fixes signed vs unsigned checks.
* Fixes MVP logging.
* Fixes item drop ratio storage.
* Fixes CSV2YAML conversion checks.
Thanks to @idk-whoami and @Lemongrass3110!
Co-authored-by: Lemongrass3110 <lemongrass@kstp.at>
This commit is contained in:
Aleos
2020-08-11 10:39:37 -04:00
committed by GitHub
parent 28aa63d24f
commit 5c5c6839a0
22 changed files with 118 additions and 126 deletions

View File

@@ -2719,7 +2719,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
dlist->item = NULL;
for (i = 0; i < MAX_MOB_DROP_TOTAL; i++) {
if (md->db->dropitem[i].nameid <= 0)
if (md->db->dropitem[i].nameid == 0)
continue;
if ( !(it = itemdb_exists(md->db->dropitem[i].nameid)) )
continue;
@@ -2877,7 +2877,8 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
}
if(mvp_sd && md->db->mexp > 0 && !md->special_state.ai) {
unsigned int log_mvp[2] = {0};
t_itemid log_mvp_nameid = 0;
t_exp log_mvp_exp = 0;
unsigned int mexp;
struct item item;
double exp;
@@ -2896,7 +2897,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
clif_mvp_effect(mvp_sd);
clif_mvp_exp(mvp_sd,mexp);
pc_gainexp(mvp_sd, &md->bl, mexp,0, 0);
log_mvp[1] = mexp;
log_mvp_exp = mexp;
if( !(map_getmapflag(m, MF_NOMVPLOOT) || type&1) ) {
//Order might be random depending on item_drop_mvp_mode config setting
@@ -2927,7 +2928,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
for(i = 0; i < MAX_MVP_DROP_TOTAL; i++) {
struct item_data *i_data;
if(mdrop[i].nameid <= 0 || !(i_data = itemdb_exists(mdrop[i].nameid)))
if(mdrop[i].nameid == 0 || !(i_data = itemdb_exists(mdrop[i].nameid)))
continue;
temp = mdrop[i].p;
@@ -2942,7 +2943,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
item.nameid=mdrop[i].nameid;
item.identify= itemdb_isidentified(item.nameid);
clif_mvp_item(mvp_sd,item.nameid);
log_mvp[0] = item.nameid;
log_mvp_nameid = item.nameid;
//A Rare MVP Drop Global Announce by Lupus
if(temp<=battle_config.rare_drop_announce) {
@@ -2971,7 +2972,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
}
}
log_mvpdrop(mvp_sd, md->mob_id, log_mvp);
log_mvpdrop(mvp_sd, md->mob_id, log_mvp_nameid, log_mvp_exp);
}
if (type&2 && !sd && md->mob_id == MOBID_EMPERIUM)
@@ -4113,7 +4114,7 @@ static unsigned int mob_drop_adjust(int baserate, int rate_adjust, unsigned shor
*/
static void item_dropratio_adjust(t_itemid nameid, int mob_id, int *rate_adjust)
{
struct s_mob_item_drop_ratio *item_ratio = (struct s_mob_item_drop_ratio *)idb_get(mob_item_drop_ratio, nameid);
struct s_mob_item_drop_ratio *item_ratio = (struct s_mob_item_drop_ratio *)uidb_get(mob_item_drop_ratio, nameid);
if( item_ratio) {
if( item_ratio->mob_id[0] ) { // only for listed mobs
int i;
@@ -5164,7 +5165,7 @@ static bool mob_readdb_itemratio(char* str[], int columns, int current)
ratio = atoi(str[1]);
if (!(item_ratio = (struct s_mob_item_drop_ratio *)idb_get(mob_item_drop_ratio,nameid)))
if (!(item_ratio = (struct s_mob_item_drop_ratio *)uidb_get(mob_item_drop_ratio,nameid)))
CREATE(item_ratio, struct s_mob_item_drop_ratio, 1);
item_ratio->drop_ratio = ratio;
@@ -5179,7 +5180,7 @@ static bool mob_readdb_itemratio(char* str[], int columns, int current)
if (!item_ratio->nameid) {
item_ratio->nameid = nameid;
idb_put(mob_item_drop_ratio, nameid, item_ratio);
uidb_put(mob_item_drop_ratio, nameid, item_ratio);
}
return true;
@@ -5612,7 +5613,7 @@ void mob_db_load(bool is_reload){
item_drop_ers = ers_new(sizeof(struct item_drop),"mob.cpp::item_drop_ers",ERS_OPT_CLEAN);
item_drop_list_ers = ers_new(sizeof(struct item_drop_list),"mob.cpp::item_drop_list_ers",ERS_OPT_NONE);
}
mob_item_drop_ratio = idb_alloc(DB_OPT_BASE);
mob_item_drop_ratio = uidb_alloc(DB_OPT_BASE);
mob_skill_db = idb_alloc(DB_OPT_BASE);
mob_summon_db = idb_alloc(DB_OPT_BASE);
mob_load();