Skip to content

Commit

Permalink
Fixed: Security issue setting account login as chat name when newest …
Browse files Browse the repository at this point in the history
…clients try to setup the chat window for the first time and the char name is not available

Fixed: Invisible chars being incorrectly revealed by REVEALF_LOOTINGOTHERS reveal flag when picking items from the ground
Fixed: Return 0/1 on spell triggers not working correctly
Fixed: Function MOVENEAR not working correctly
  • Loading branch information
coruja747 committed Jul 22, 2016
1 parent 0b6dc44 commit f26b39b
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 31 deletions.
8 changes: 7 additions & 1 deletion docs/REVISIONS-56-SERIES.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,10 @@ Fixed: Spawns (worldgem bit) not updating DISPID when set SPAWNDEF on MORE1.

14-07-2016, Coruja
Changed: Improved some NPCs interactions with players.
Fixed: Spawns (worldgem bit) creating chars on stuck locations.
Fixed: Spawns (worldgem bit) creating chars on stuck locations.

22-07-2016, Coruja
Fixed: Security issue setting account login as chat name when newest clients try to setup the chat window for the first time and the char name is not available.
Fixed: Invisible chars being incorrectly revealed by REVEALF_LOOTINGOTHERS reveal flag when picking items from the ground.
Fixed: Return 0/1 on spell triggers not working correctly.
Fixed: Function MOVENEAR not working correctly.
20 changes: 7 additions & 13 deletions src/graysvr/CCharSpell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2678,16 +2678,10 @@ bool CChar::Spell_CastDone()
{
// Display spell.
if (pObj)
{
if (!pObj->OnSpellEffect(spell, this, iSkillLevel, static_cast<CItem *>(pObjSrc)))
return false;
}
pObj->OnSpellEffect(spell, this, iSkillLevel, dynamic_cast<CItem *>(pObjSrc));
else
{
if (!iT1)
iT1 = ITEMID_FX_FLAMESTRIKE;

CItem *pItem = CItem::CreateBase(iT1);
CItem *pItem = CItem::CreateBase(iT1 ? iT1 : ITEMID_FX_FLAMESTRIKE);
ASSERT(pItem);
pItem->SetType(IT_SPELL);
pItem->m_itSpell.m_spell = SPELL_Flame_Strike;
Expand All @@ -2697,8 +2691,8 @@ bool CChar::Spell_CastDone()
}

case SPELL_Gate_Travel:
if (!Spell_Recall(dynamic_cast <CItem*> (pObj), true))
return(false);
if (!Spell_Recall(dynamic_cast<CItem *>(pObj), true))
return false;
break;

case SPELL_Polymorph:
Expand All @@ -2712,8 +2706,7 @@ bool CChar::Spell_CastDone()
// This has a menu select for client.
if (!pObj || ((pObj != this) && (GetPrivLevel() < PLEVEL_Seer)))
return false;
if (!pObj->OnSpellEffect(spell, this, iSkillLevel, static_cast<CItem *>(pObjSrc)))
return false;
pObj->OnSpellEffect(spell, this, iSkillLevel, dynamic_cast<CItem *>(pObjSrc));
break;
}

Expand Down Expand Up @@ -2798,8 +2791,9 @@ bool CChar::Spell_CastDone()

default:
{
if (!pObj || !pObj->OnSpellEffect(spell, this, iSkillLevel, static_cast<CItem *>(pObjSrc)))
if (!pObj)
return false;
pObj->OnSpellEffect(spell, this, iSkillLevel, dynamic_cast<CItem *>(pObjSrc));
break;
}
}
Expand Down
31 changes: 18 additions & 13 deletions src/graysvr/CCharact.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1594,17 +1594,20 @@ int CChar::ItemPickup(CItem * pItem, int amount)
return -1;
}

const CItemCorpse * pCorpse = dynamic_cast<const CItemCorpse *>(pObjTop);
if ( pCorpse && pCorpse->m_uidLink == GetUID() )
{
if ( g_Cfg.m_iRevealFlags & REVEALF_LOOTINGSELF )
Reveal();
}
else
const CItemCorpse *pCorpse = dynamic_cast<const CItemCorpse *>(pObjTop);
if ( pCorpse )
{
CheckCorpseCrime(pCorpse, true, false);
if ( g_Cfg.m_iRevealFlags & REVEALF_LOOTINGOTHERS )
Reveal();
if ( pCorpse->m_uidLink == GetUID() )
{
if ( g_Cfg.m_iRevealFlags & REVEALF_LOOTINGSELF )
Reveal();
}
else
{
CheckCorpseCrime(pCorpse, true, false);
if ( g_Cfg.m_iRevealFlags & REVEALF_LOOTINGOTHERS )
Reveal();
}
}

int iAmountMax = pItem->GetAmount();
Expand Down Expand Up @@ -1656,9 +1659,11 @@ int CChar::ItemPickup(CItem * pItem, int amount)
if ( trigger == ITRIG_PICKUP_GROUND )
{
// bug with taking static/movenever items -or- catching the spell effects
if ( IsPriv(PRIV_ALLMOVE|PRIV_GM) ) ;
else if ( pItem->IsAttr(ATTR_STATIC|ATTR_MOVE_NEVER) || pItem->IsType(IT_SPELL) )
return -1;
if ( !IsPriv(PRIV_ALLMOVE|PRIV_GM) )
{
if ( pItem->IsAttr(ATTR_STATIC|ATTR_MOVE_NEVER) || pItem->IsType(IT_SPELL) )
return -1;
}
}

if ( trigger != ITRIG_UNEQUIP ) // unequip is done later.
Expand Down
2 changes: 0 additions & 2 deletions src/graysvr/CChat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -570,8 +570,6 @@ void CChat::GenerateChatName(CGString &sName, const CClient * pClient) // static
LPCTSTR pszName = NULL;
if (pClient->GetChar() != NULL)
pszName = pClient->GetChar()->GetName();
else if (pClient->GetAccount() != NULL)
pszName = pClient->GetAccount()->GetName();

if (pszName == NULL)
return;
Expand Down
4 changes: 2 additions & 2 deletions src/graysvr/CObjBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,10 +473,10 @@ bool CObjBase::MoveNear( CPointMap pt, WORD iSteps )
// Move to nearby this other object.
// Actually move it within +/- iSteps

CChar *pChar = IsChar() ? static_cast<CChar *>(this) : NULL;
CChar *pChar = dynamic_cast<CChar *>(this);
CPointMap ptOld = pt;

for ( WORD i = 0; i < iSteps; i++ )
for ( WORD i = 0; i < 20; i++ )
{
pt = ptOld;
pt.m_x += static_cast<signed short>(Calc_GetRandVal2(-iSteps, iSteps));
Expand Down

0 comments on commit f26b39b

Please sign in to comment.