Jump to content

[HELP] How to get item addon value?


Recommended Posts

  • 5 months later...
  • Forum Moderator
//#include "item_manager.h"	
const TItemTable * proto = ITEM_MANAGER::instance().GetTable(12019);
if (proto)
{
	for (size_t i = 0; i < ITEM_APPLY_MAX_NUM; ++i)
		sys_log("applyType[%d] = %d, applyValue[%d] = %d", i, proto->aApplies[i].bType, i, proto->aApplies[i].lValue);
}

>>> applyType[0] = 8, applyValue[0] = -6
>>> applyType[1] = 37, applyValue[1] = 20
>>> applyType[2] = 10, applyValue[2] = 40

 

Link to comment
Share on other sites

AddonValue does not exist, but AddonType:

// item.h
		short int		GetAddonType()		{ return m_pProto ? m_pProto->sAddonType : 0; }

// questlua_item.cpp
	int item_get_addon_type(lua_State* L)
	{
		CQuestManager& q = CQuestManager::instance();
		LPITEM item = q.GetCurrentItem();

		if (item)
			lua_pushnumber(L, item->GetAddonType());
		else
			lua_pushnumber(L, 0);

		return 1;
	}

// questlua_item.cpp
			{ "get_addon_type",		item_get_addon_type },

 

  • Love 1
Link to comment
Share on other sites

  • Forum Moderator

They exists, are the self-notations from item_proto.txt, so addon_type & addon_value are apply_type & apply_value.

  • ITEM_VNUM~RANGE    ITEM_NAME(K)    ITEM_TYPE    SUB_TYPE    SIZE    ANTI_FLAG    FLAG    ITEM_WEAR    IMMUNE    GOLD    SHOP_BUY_PRICE    REFINE    REFINESET    MAGIC_PCT    LIMIT_TYPE0    LIMIT_VALUE0    LIMIT_TYPE1    LIMIT_VALUE1    ADDON_TYPE0    ADDON_VALUE0    ADDON_TYPE1    ADDON_VALUE1    ADDON_TYPE2    ADDON_VALUE2    VALUE0    VALUE1    VALUE2    VALUE3    VALUE4    VALUE5    Specular    SOCKET    ATTU_ADDON
Quote

return m_pProto ? m_pProto->sAddonType : 0;

Btw, you don't need the value, ymir wasn't used the value of addon type in game (#1, #2), just take it as a simple boolean condition if it's true (-1) or 0, and inside of CItemAddonManager::ApplyAddonTo(int iAddonType, LPITEM pItem) the argument is unused.

So it's enough to return a simple boolean.

This is the hidden content, please

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 14
  • Scream 1
  • Good 4
  • Love 7
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.