Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Jhobean committed Jan 21, 2025
1 parent b6430d1 commit 4fa7fdf
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 12 deletions.
4 changes: 4 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3988,3 +3988,7 @@ Added: 'H' shortcut for variables to get the value as hexadecimal.

08-01-2025, DavideRei
- Fixed: NPC FLEE action didn't work because it was using action target (empty) instead of fight target

20-01-2025, Xwerswoodx
Changed: Now CHARDEFs can read custom Item Resources as an ICON, the restriction of being TILEDATA value is removed. (Issue: #1301)
Fixed: The unmatched default value query was causing the price of items without a set price to return as -2,147,483,648. (Issue: #1233)
38 changes: 27 additions & 11 deletions src/game/chars/CCharBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,9 @@ bool CCharBase::r_WriteVal( lpctstr ptcKey, CSString & sVal, CTextConsole * pSrc
case CBC_HIREDAYWAGE:
sVal.FormatVal( m_iHireDayWage );
break;
case CBC_ICON:
sVal.FormatHex( m_trackID );
break;
case CBC_ICON:
sVal.FormatHex(m_trackID);
break;
case CBC_INT:
sVal.FormatVal( m_Int );
break;
Expand Down Expand Up @@ -390,14 +390,30 @@ bool CCharBase::r_LoadVal( CScript & s )
case CBC_HIREDAYWAGE:
m_iHireDayWage = s.GetArgVal();
break;
case CBC_ICON:
{
ITEMID_TYPE id = (ITEMID_TYPE)(g_Cfg.ResourceGetIndexType( RES_ITEMDEF, s.GetArgStr()));
if ( (id < 0) || (id >= ITEMID_MULTI) )
return false;
m_trackID = id;
}
break;
case CBC_ICON:
{
ITEMID_TYPE id = (ITEMID_TYPE)s.GetArgDWVal();
if (id > ITEMID_NOTHING) //Is ICON valid item?
{
m_trackID = id;
}
else //If ICON is invalid, check the base Character ICON.
{
CREID_TYPE baseID = (CREID_TYPE)GetResourceID().GetResIndex();
CCharBase *pBase = FindCharBase(baseID);
if (pBase && pBase->m_trackID > ITEMID_NOTHING)
{
m_trackID = pBase->m_trackID;
}
else
{
// This should only happen if the char and the base char has no icon defined.
// If all checks invalid, return i_pet_wisp as default icon.
m_trackID = ITEMID_TRACK_WISP;
}
}
break;
}
case CBC_ID:
return SetDispID((CREID_TYPE)(g_Cfg.ResourceGetIndexType( RES_CHARDEF, s.GetArgStr())));
case CBC_INT:
Expand Down
2 changes: 1 addition & 1 deletion src/game/items/CItemBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,7 @@ int CItemBase::GetMakeValue( int iQualityLevel )

CValueRangeDef values(m_values);

if ( m_values.m_iLo == INT64_MIN || m_values.m_iHi == INT64_MIN )
if ( m_values.m_iLo == INT32_MIN || m_values.m_iHi == INT32_MIN )
{
values.m_iLo = CalculateMakeValue(0); // low quality specimen
m_values.m_iLo = -values.m_iLo; // negative means they will float.
Expand Down

0 comments on commit 4fa7fdf

Please sign in to comment.