diff --git a/Changelog.txt b/Changelog.txt index 034689fd8..64742dbe6 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -3914,3 +3914,36 @@ Added: 'H' shortcut for variables to get the value as hexadecimal. 13-10-2024, Jhobean - Added: @PetRelease trigger work like @petdesert and return 1 to prevent the pet from being released. + +16-10-2024, xwerswoodx +- Added: spherecustom.ini definition has been added to Sphere. + This allows you to override Sphere settings without touching the Sphere.ini file. + For example, when you want to switch from an older Sphere version to 56x or when you haven't updated for a long time, instead of checking all the new data + added to Sphere.ini one by one, you can simply use your old sphere.ini as spherecustom.ini. This way, newly added data will take the default settings from + Sphere.ini, while your previous custom settings will override the defaults without requiring any further adjustments. + On the other hand, it helps you maintain a clean Sphere.ini. Instead of directly changing the Sphere.ini settings, you can create a spherecustom.ini file + and add only the settings you want to change there, allowing you to easily track the changes without modifying Sphere.ini. + Here's an example of a spherecustom.ini: + [SPHERE] + AGREE=1 + + // Server Data + ServName=MyCuteServer + ServIP=255.255.255.255 + ServPort=2593 + + // Server Settings + AdvancedLos=2 + GuardsInstatntKill=0 + FeatureT2A = 01|02 + + [SERVERS] + MyCuteServer + 255.255.255.255 + 2593 + + [EOF] +- Changed: Now CHARDEFs can read custom Item Resources as an ICON, the restriction of being TILEDATA value is removed. (Issue: #1301) + +16-10-2024, canerksk +Fixed: The mismatched default value check was causing the price of items without a set price to return as -2,147,483,648. (Issue: #1233) diff --git a/src/game/CServerConfig.cpp b/src/game/CServerConfig.cpp index 6beadd6bd..f3d649a90 100644 --- a/src/game/CServerConfig.cpp +++ b/src/game/CServerConfig.cpp @@ -4542,23 +4542,37 @@ void CServerConfig::PrintEFOFFlags(bool bEF, bool bOF, CTextConsole *pSrc) bool CServerConfig::LoadIni( bool fTest ) { - ADDTOCALLSTACK("CServerConfig::LoadIni"); - // Load my INI file first. - if ( ! OpenResourceFind( m_scpIni, SPHERE_FILE ".ini", !fTest )) // Open script file - { - if( !fTest ) - { - g_Log.Event(LOGL_FATAL|LOGM_INIT|LOGF_CONSOLE_ONLY, SPHERE_FILE ".ini has not been found.\n"); - g_Log.Event(LOGL_FATAL|LOGM_INIT|LOGF_CONSOLE_ONLY, "Download a sample sphere.ini from https://github.com/Sphereserver/Source-X/tree/master/src\n"); - } - return false; - } - - LoadResourcesOpen(&m_scpIni); - m_scpIni.Close(); - m_scpIni.CloseForce(); + ADDTOCALLSTACK("CServerConfig::LoadIni"); + // Load my INI file first. + if (!OpenResourceFind(m_scpIni, SPHERE_FILE ".ini", !fTest)) // Open script file + { + if (!fTest) + { + g_Log.Event(LOGL_FATAL | LOGM_INIT | LOGF_CONSOLE_ONLY, SPHERE_FILE ".ini has not been found.\n"); + g_Log.Event( + LOGL_FATAL | LOGM_INIT | LOGF_CONSOLE_ONLY, "Download a sample sphere.ini from https://github.com/Sphereserver/Source-X/tree/master/src\n"); + } + return false; + } + LoadResourcesOpen(&m_scpIni); + m_scpIni.Close(); + m_scpIni.CloseForce(); + m_scpCustomIni.Close(); + m_scpCustomIni.CloseForce(); + + // Load SphereCustom.ini after Sphere.ini to override values. + lpctstr sCustomIni = SPHERE_FILE "custom.ini"; + if (CSFile::FileExists(sCustomIni)) + { + if (OpenResourceFind(m_scpCustomIni, sCustomIni, !fTest)) + { + LoadResourcesOpen(&m_scpCustomIni); + m_scpCustomIni.Close(); + m_scpCustomIni.CloseForce(); + } + } - return true; + return true; } bool CServerConfig::LoadCryptIni( void ) @@ -4596,8 +4610,9 @@ void CServerConfig::Unload( bool fResync ) break; pResFile->CloseForce(); } - m_scpIni.CloseForce(); - m_scpTables.CloseForce(); + m_scpIni.CloseForce(); + m_scpCustomIni.CloseForce(); + m_scpTables.CloseForce(); return; } @@ -4680,6 +4695,8 @@ bool CServerConfig::Load( bool fResync ) { m_scpIni.ReSync(); m_scpIni.CloseForce(); + m_scpCustomIni.ReSync(); + m_scpCustomIni.CloseForce(); } // Now load the *TABLES.SCP file. diff --git a/src/game/CServerConfig.h b/src/game/CServerConfig.h index f47025fc2..ca07a65f6 100644 --- a/src/game/CServerConfig.h +++ b/src/game/CServerConfig.h @@ -607,6 +607,7 @@ extern class CServerConfig : public CResourceHolder // End INI file options. CResourceScript m_scpIni; // Keep this around so we can link to it. + CResourceScript m_scpCustomIni; // Custom optional spherecustom.ini CResourceScript m_scpCryptIni; // Encryption keys are in here CResourceScript m_scpTables; // Script's loaded. diff --git a/src/game/chars/CCharBase.cpp b/src/game/chars/CCharBase.cpp index 30ecdb6e2..e5f99ea82 100644 --- a/src/game/chars/CCharBase.cpp +++ b/src/game/chars/CCharBase.cpp @@ -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; @@ -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: diff --git a/src/game/items/CItemBase.cpp b/src/game/items/CItemBase.cpp index 1d888e94a..5ef0c09ef 100644 --- a/src/game/items/CItemBase.cpp +++ b/src/game/items/CItemBase.cpp @@ -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. diff --git a/src/network/receive.cpp b/src/network/receive.cpp index 50e36e308..8978d6d14 100644 --- a/src/network/receive.cpp +++ b/src/network/receive.cpp @@ -2500,7 +2500,7 @@ bool PacketClientVersion::onReceive(CNetState* net) /*************************************************************************** * * -* Packet 0xBD : PacketAssistVersion assist version +* Packet 0xBE : PacketAssistVersion assist version * * ***************************************************************************/