Jump to content
  • 0

Custom script command like autofavoriteitem from hercules


WhiteEagle

Question


  • Group:  Members
  • Topic Count:  76
  • Topics Per Day:  0.02
  • Content Count:  461
  • Reputation:   61
  • Joined:  08/28/12
  • Last Seen:  

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);
	}

 

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...