2012-06-14 09:06:06 -04:00
|
|
|
|
|
|
|
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
|
|
|
|
|
2012-09-23 18:09:57 -04:00
|
|
|
#include "Item.h"
|
2012-06-14 09:06:06 -04:00
|
|
|
#include <json/json.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void cItem::GetJson( Json::Value & a_OutValue ) const
|
|
|
|
{
|
|
|
|
a_OutValue["ID"] = m_ItemID;
|
|
|
|
if( m_ItemID > 0 )
|
|
|
|
{
|
|
|
|
a_OutValue["Count"] = m_ItemCount;
|
|
|
|
a_OutValue["Health"] = m_ItemHealth;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void cItem::FromJson( const Json::Value & a_Value )
|
|
|
|
{
|
|
|
|
m_ItemID = (ENUM_ITEM_ID)a_Value.get("ID", -1 ).asInt();
|
|
|
|
if( m_ItemID > 0 )
|
|
|
|
{
|
|
|
|
m_ItemCount = (char)a_Value.get("Count", -1 ).asInt();
|
|
|
|
m_ItemHealth = (short)a_Value.get("Health", -1 ).asInt();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-18 05:56:28 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool cItem::IsEnchantable(short item)
|
2012-06-14 09:06:06 -04:00
|
|
|
{
|
2012-08-18 05:56:28 -04:00
|
|
|
if ((item >= 256) && (item <= 259))
|
2012-06-14 09:06:06 -04:00
|
|
|
return true;
|
2012-08-18 05:56:28 -04:00
|
|
|
if ((item >= 267) && (item <= 279))
|
2012-06-14 09:06:06 -04:00
|
|
|
return true;
|
2012-08-18 05:56:28 -04:00
|
|
|
if ((item >= 283) && (item <= 286))
|
2012-06-14 09:06:06 -04:00
|
|
|
return true;
|
2012-08-18 05:56:28 -04:00
|
|
|
if ((item >= 290) && (item <= 294))
|
2012-06-14 09:06:06 -04:00
|
|
|
return true;
|
2012-08-18 05:56:28 -04:00
|
|
|
if ((item >= 298) && (item <= 317))
|
2012-06-14 09:06:06 -04:00
|
|
|
return true;
|
2012-08-18 05:56:28 -04:00
|
|
|
if ((item >= 290) && (item <= 294))
|
2012-06-14 09:06:06 -04:00
|
|
|
return true;
|
|
|
|
|
2012-08-18 05:56:28 -04:00
|
|
|
if ((item == 346) || (item == 359) || (item == 261))
|
2012-06-14 09:06:06 -04:00
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2012-08-18 05:56:28 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|