Closed s0ckz closed 7 years ago
Not sure if it's the best solution, but in my own version I've put:
if ( iStamReq < 0 ) // changed here (it was <=)
continue;
if ( Stat_GetVal(STAT_DEX) < Stat_GetMax(STAT_DEX) )
return NULL;
TCHAR *pszMsg = Str_GetTemp();
if ( iStamReq != 0 && Stat_GetVal(STAT_DEX) < iStamReq ) // and here (I've added the first condition)
{
...
try using this code to check if it works
EXC_SET("Creature bumping");
short iStamReq = 0;
if ( fCheckChars && !IsStatFlag(STATF_DEAD|STATF_Sleeping|STATF_Insubstantial) )
{
CItem *pPoly = LayerFind(LAYER_SPELL_Polymorph);
CWorldSearch AreaChars(ptDst);
for (;;)
{
CChar *pChar = AreaChars.GetChar();
if ( !pChar )
break;
if ( (pChar == this) || (abs(pChar->GetTopZ() - ptDst.m_z) > 5) || pChar->IsStatFlag(STATF_Insubstantial) )
continue;
if ( m_pNPC && pChar->m_pNPC ) // NPCs can't walk over another NPC
return NULL;
iStamReq = 10;
if ( IsPriv(PRIV_GM) || pChar->IsStatFlag(STATF_DEAD|STATF_Invisible|STATF_Hidden) )
iStamReq = 0;
else if ( pPoly && (pPoly->m_itSpell.m_spell == SPELL_Wraith_Form) && (GetTopMap() == 0) ) // chars under Wraith Form effect can always walk through chars in Felucca
iStamReq = 0;
TRIGRET_TYPE iRet = TRIGRET_RET_DEFAULT;
if ( IsTrigUsed(TRIGGER_PERSONALSPACE) )
{
CScriptTriggerArgs Args(iStamReq);
iRet = pChar->OnTrigger(CTRIG_PersonalSpace, this, &Args);
if ( iRet == TRIGRET_RET_TRUE )
return NULL;
iStamReq = static_cast<short>(Args.m_iN1);
if ( iStamReq < 0 )
continue;
}
if ( (iStamReq > 0) && (Stat_GetVal(STAT_DEX) < Stat_GetMax(STAT_DEX)) )
return NULL;
TCHAR *pszMsg = Str_GetTemp();
if ( Stat_GetVal(STAT_DEX) < iStamReq ) // check if we have enough stamina to push the char
{
sprintf(pszMsg, g_Cfg.GetDefaultMsg(DEFMSG_MSG_CANTPUSH), pChar->GetName());
SysMessage(pszMsg);
return NULL;
}
else if ( pChar->IsStatFlag(STATF_Invisible|STATF_Hidden) )
{
sprintf(pszMsg, g_Cfg.GetDefaultMsg(DEFMSG_HIDING_STUMBLE), pChar->GetName());
pChar->Reveal(STATF_Invisible|STATF_Hidden);
}
else if ( pChar->IsStatFlag(STATF_Sleeping) )
sprintf(pszMsg, g_Cfg.GetDefaultMsg(DEFMSG_MSG_STEPON_BODY), pChar->GetName());
else
sprintf(pszMsg, g_Cfg.GetDefaultMsg(DEFMSG_MSG_PUSH), pChar->GetName());
if ( iRet != TRIGRET_RET_FALSE )
SysMessage(pszMsg);
break;
}
}
Thanks. I'll test and report here.
Yes. It did work! It shows the hidden player even if stam < maxstam, which is expected, right?
Hi,
At this commit (https://github.com/Sphereserver/Source/commit/8a526a407441f941ea4a2862eb700bcf833bbfe4) I guess a new bug was introduced... It says is not required stamina to stumble at a hidden char, so the code uses iStamReq = 0. But at a following if, there's a continue statement when iStamReq <= 0 before the condition to check if a player is being stumbled.