In hercules, there is a script command that puts items that are looted directly into the FAV inventory.
*setfavoriteitemidx(<idx>, <flag>)
This function will set an item in inventory as favorite or not.
If its favorite item, it will be moved to favorite tab, else move out from favorite tab.
Note: Cant change favorite flag of an equipped item.
Valid Parameters:
<idx> - inventory index, refer *getinventorylist()
<flag> - true/false (true = favorite item, false = otherwise)
---------------------------------------
*autofavoriteitem(<item_id>, <flag>)
This function will auto set an item as favorite when <item_id> is obtained.
If its favorite item, it will be auto moved to favorite tab, else move out from favorite tab.
This setting affect not only attached player, but also everyone player globally.
Valid Parameters:
<item_id> - item ID
<flag> - true/false (true = favorite item, false = otherwise)
Does anyone know a similar funtion in rAthena or can create this for rAthena?
That would be really great and practical.
Currently I have to do this in pc.cpp for each individual item. ( Marked in the field with /////)
if (i >= MAX_INVENTORY) {
i = pc_search_inventory(sd,0);
if( i < 0 )
return ADDITEM_OVERITEM;
memcpy(&sd->inventory.u.items_inventory[i], item, sizeof(sd->inventory.u.items_inventory[0]));
// clear equip and favorite fields first, just in case
if( item->equip )
sd->inventory.u.items_inventory[i].equip = 0;
if( item->favorite )
sd->inventory.u.items_inventory[i].favorite = 0;
if( item->equipSwitch )
sd->inventory.u.items_inventory[i].equipSwitch = 0;
sd->inventory.u.items_inventory[i].amount = amount;
sd->inventory_data[i] = id;
sd->last_addeditem_index = i;
if (!itemdb_isstackable2(id) || id->flag.guid)
sd->inventory.u.items_inventory[i].unique_id = item->unique_id ? item->unique_id : pc_generate_unique_id(sd);
//////////////////////////////////////////
if ( item->nameid == 32510 )
sd->inventory.u.items_inventory[i].favorite = 1;
//////////////////////////////////////////
clif_additem(sd,i,amount,0);
}