Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4144,3 +4144,7 @@ When setting a property like MORE to the a spell or skill defname, trying to rea

23-07-2026, canerksk
- Added: New local variable local.Sound to @SpellFail/@Fail triggers (R/W). If you set local.sound = 0, no sound will be played.

14-09-2026, Mulambo
WARNING! POTENTIALLY BREAKING CHANGE!
- Changed: Chance to hit in `CombatDamageEra=0` (Sphere custom) now returns calculated value, instead of random number from that value.
14 changes: 7 additions & 7 deletions src/common/CServerMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -694,16 +694,15 @@ void CServerMapDiffCollection::LoadMapDiffs()
if ( !g_MapList.IsMapSupported( m ) )
continue;

const int map = g_MapList.GetMapID(m);

// Load Mapdif Files
{
CSFile * pFileMapdif = &(g_Install.m_Mapdif[map]);
CSFile * pFileMapdifl = &(g_Install.m_Mapdifl[map]);
CSFile *pFileMapdif = &g_Install.m_Mapdif[m];
CSFile *pFileMapdifl = &g_Install.m_Mapdifl[m];

// Check that the relevant dif files are available
if ( pFileMapdif->IsFileOpen() && pFileMapdifl->IsFileOpen() )
{
const int map = g_MapList.GetMapID(m);
// Make sure that we're at the beginning of the files
pFileMapdif->SeekToBegin();
pFileMapdifl->SeekToBegin();
Expand Down Expand Up @@ -744,14 +743,15 @@ void CServerMapDiffCollection::LoadMapDiffs()

// Load Stadif Files
{
CSFile * pFileStadif = &(g_Install.m_Stadif[map]);
CSFile * pFileStadifl = &(g_Install.m_Stadifl[map]);
CSFile * pFileStadifi = &(g_Install.m_Stadifi[map]);
CSFile *pFileStadif = &g_Install.m_Stadif[m];
CSFile *pFileStadifl = &g_Install.m_Stadifl[m];
CSFile *pFileStadifi = &g_Install.m_Stadifi[m];

// Check that the relevant dif files are available
if ( !pFileStadif->IsFileOpen() || !pFileStadifl->IsFileOpen() || !pFileStadifi->IsFileOpen() )
continue;

const int map = g_MapList.GetMapID(m);
// Make sure that we're at the beginning of the files
pFileStadif->SeekToBegin();
pFileStadifl->SeekToBegin();
Expand Down
3 changes: 1 addition & 2 deletions src/game/CResourceCalc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,7 @@ int CServerConfig::Calc_CombatChanceToHit(const CChar * pChar, const CChar * pCh
if (pCharTarg->IsStatFlag(STATF_SLEEPING | STATF_FREEZE) && iChance < 80)
iChance = 80;

// Always need to have some chance (@todo Remove this horrendous random).
return g_Rand.GetVal(iChance);
return iChance;
}
// Pre-AOS formula.
case 1:
Expand Down
2 changes: 1 addition & 1 deletion src/game/chars/CChar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ void CChar::ClearPlayer()
{
if (g_Serv.GetServerMode() != ServMode::Exiting)
{
g_Log.EventWarn("Character '%s'(UID 0%x) on account '%s' as been deleted.\n", GetName(), (dword)GetUID(), pAccount->GetName());
g_Log.EventWarn("Character '%s'(UID 0%x) on account '%s' has been deleted.\n", GetName(), (dword)GetUID(), pAccount->GetName());
}

pAccount->DetachChar(this); // unlink me from my account.
Expand Down
12 changes: 7 additions & 5 deletions src/game/chars/CCharAct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5974,7 +5974,7 @@ bool CChar::_OnTick()
const bool fTickableState = _CanTick(false);
const bool fSleeping = _IsSleeping();

//#ifdef _DEBUG
#ifdef _DEBUG
if (!fTickableState || fSleeping)
{
g_Log.EventDebug("[Temporary msg] Char '%s' (UID=0x%" PRIx32 ") at P=%s is in the ticking list with unusual CanTick=%d, SleepingState=%d.\n",
Expand All @@ -5983,10 +5983,11 @@ bool CChar::_OnTick()
(int)fTickableState, (int)fSleeping
);
}
//#endif
#endif

if (!fTickableState)
{
#ifdef _DEBUG
// It can happen that i'm in the ticking list, but for various reasons right now i'm in a non-tickable state.
// Among the reasons why i can't tick, though, there cannot be being in a sleeping state: when a char goes into sleeping state
// it should also be removed from the list (it happens in _GoSleep()).
Expand All @@ -5995,15 +5996,16 @@ bool CChar::_OnTick()
(int)GetTopSector()->IsSleeping());
}
//ASSERT(!fSleeping);
#endif

if (GetTopSector()->IsSleeping() && !g_Rand.Get16ValFast(15))
if (GetTopSector()->IsSleeping() && !g_Rand.Get16ValFast(15))
{
// Do not make the char sleep right when it enters a sleeping sector. Doing this
// will lead to an accumulation of npcs at the edge of the new sector.

//#ifdef _DEBUG
#ifdef _DEBUG
g_Log.EventDebug("[Temporary msg] Sent CChar to sleep (random), to be awaken alongside its sector.\n");
//#endif
#endif

_SetTimeout(1); //Make it tick after sector's awakening.
_GoSleep();
Expand Down
19 changes: 18 additions & 1 deletion src/game/clients/CClientEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,24 @@ void CClient::Event_Item_Drop( CUID uidItem, CPointMap pt, CUID uidOn, uchar gri

if ( pContItem != nullptr )
{
// bug with shifting selling list by gold coins
// If player is trying to put container inside its child, it will crash sphere due to circular weight calculation.
auto *const pItemIsContainer = dynamic_cast<CItemContainer *>(pItem);
if (pItemIsContainer && pItemIsContainer->IsItemInside(pContItem))
{
Event_Item_Drop_Fail(pItem);
// Log the error.
g_Log.EventError("Player '%s' (UID 0%x) trying to drop container '%s' (UID 0%x) inside its child container '%s' (UID 0%x).\n",
m_pChar->GetName(), static_cast<dword>(m_pChar->GetUID()),
pItem->GetName(), static_cast<dword>(pItem->GetUID()),
pContItem->GetName(), static_cast<dword>(pContItem->GetUID())
);
// Disconnect character. This behavior cannot be done manually and script might be called indefinitely.
CharDisconnect();
GetNetState()->markReadClosed();
return;
}

// Bug with shifting selling list by gold coins.
if ( pContItem->IsType(IT_EQ_VENDOR_BOX) &&
( pItem->IsType(IT_GOLD) || pItem->IsType(IT_COIN) ))
{
Expand Down
8 changes: 6 additions & 2 deletions src/game/items/CItemContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -906,8 +906,12 @@ bool CItemContainer::CanContainerHold( const CItem *pItem, const CChar *pCharMsg
int iMaxWeight = m_ModMaxWeight;
if ((GetContainedLayer() == LAYER_PACK) && !(g_Cfg.m_iBackpackOverload <= -1))
{
CChar* pCharContainerOwner = static_cast<CChar*>(GetContainer()); // Owner of the container
iMaxWeight += (g_Cfg.Calc_MaxCarryWeight(pCharContainerOwner) + g_Cfg.m_iBackpackOverload);
// Allow more weight based on settings.
auto const *pCharContainerOwner = dynamic_cast<CChar*>(GetContainer());
if (pCharContainerOwner)
{
iMaxWeight += (g_Cfg.Calc_MaxCarryWeight(pCharContainerOwner) + g_Cfg.m_iBackpackOverload);
}
}
if (iMaxWeight > 0 && (GetTotalWeight() + pItem->GetWeight() > iMaxWeight))
{
Expand Down
3 changes: 2 additions & 1 deletion src/network/receive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2600,7 +2600,8 @@ bool PacketScreenSize::onReceive(CNetState* net)
skip(2);

//DEBUG_MSG(("PacketScreenSize::onReceive 0x%hx - 0x%hx (%hu-%hu)\n", x, y, x, y));
if (net->isClientVersionNumber(MINCLIVER_NEWBOOK))
// Set default height only if client send width and no height.
if (net->isClientVersionNumber(MINCLIVER_NEWBOOK) && x > 0 && y == 0)
{
switch (x)
{
Expand Down
2 changes: 2 additions & 0 deletions src/sphereCrypt.ini
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ ENC_LOGIN 4 // Rotation cipher used for the Login Server crypt by every client,

[SPHERECRYPT]
// Classic Clients.
70011700 0366150AD 0AC9E5E7F ENC_TFISH // 7.0.117
70011600 0369A82BD 0AC15127F ENC_TFISH // 7.0.116
70011500 036DCF0CD 0AC2CDE7F ENC_TFISH // 7.0.115
70011400 037062ADD 0ACCA227F ENC_TFISH // 7.0.114
Expand Down Expand Up @@ -239,6 +240,7 @@ ENC_LOGIN 4 // Rotation cipher used for the Login Server crypt by every client,
1232700 0D47BD45C 034081CD6 ENC_LOGIN // 1.23.27

// Enhanced Clients.
670011700 0146150AD 0BD9E5E7F ENC_TFISH // 4.0.117
670011600 0149A82BD 0BD15127F ENC_TFISH // 4.0.116
670011500 014DCF0CD 0BD2CDE7F ENC_TFISH // 4.0.115
670011400 015062ADD 0BDCA227F ENC_TFISH // 4.0.114
Expand Down
Loading