I'm trying to add an additional loot command to only autoloot if an item does not have a drop effect set in the DB. I still haven't gotten this new command filter to work correctly because it's still looting everything. If anyone spots where I'm going wrong it would be greatly appreciated.
/*==========================================
* @lootcommon - autoloots common items and drops most rares with drop effects.
* Made by Moobs/NickyB
*------------------------------------------*/
ACMD_FUNC(lootcommon){int rate;
nullpo_retr(-1, sd);if(sd->state.autoloot)
rate =0;else
rate =10000;
sd->state.autoloot = rate;if(sd->state.autoloot){
clif_displaymessage(fd,"Autoloot common loot is now enabled.");
sd->state.lootcommon =1;}else{
clif_displaymessage(fd,"Autoloot common loot is now disabled.");// Autoloot is now off.
sd->state.lootcommon =0;}return0;}
pc.cpp
/**
* Check if player is autolooting given itemID.
*/
bool pc_isautolooting(struct map_session_data *sd, t_itemid nameid)
{
uint8 i = 0;
std::shared_ptr<item_data> item_data;
item_data = item_db.find(nameid);
//add lootcommon
if (sd->state.lootcommon && item_data->flag.dropEffect != 0)
return false;
if (sd->state.autoloottype && sd->state.autoloottype&(1<<itemdb_type(nameid)))
returntrue;
if (!sd->state.autolooting)
return false;
if (sd->state.autolooting)
ARR_FIND(0, AUTOLOOTITEM_SIZE, i, sd->state.autolootid[i] == nameid);
return (i != AUTOLOOTITEM_SIZE);
}
Question
nickyb
I'm trying to add an additional loot command to only autoloot if an item does not have a drop effect set in the DB. I still haven't gotten this new command filter to work correctly because it's still looting everything. If anyone spots where I'm going wrong it would be greatly appreciated.
pc.cpp
4 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.