1
0

Fixed a bug who can used from hacked clients.

This commit is contained in:
Howaner 2014-08-02 00:14:05 +02:00
parent b5c0a4aa3a
commit 3b4255dbfe
2 changed files with 18 additions and 1 deletions

View File

@ -90,6 +90,7 @@ bool cBeaconEntity::SetPrimaryEffect(cEntityEffect::eType a_Effect)
{
if (!IsValidEffect(a_Effect, m_BeaconLevel))
{
m_PrimaryEffect = cEntityEffect::effNoEffect;
return false;
}
@ -111,6 +112,7 @@ bool cBeaconEntity::SetSecondaryEffect(cEntityEffect::eType a_Effect)
{
if (!IsValidEffect(a_Effect, m_BeaconLevel))
{
m_SecondaryEffect = cEntityEffect::effNoEffect;
return false;
}

View File

@ -795,7 +795,22 @@ void cClientHandle::HandleBeaconSelection(const char * a_Data, size_t a_Length)
Window->SetSlot(*m_Player, 0, cItem());
BeaconWindow->GetBeaconEntity()->SetPrimaryEffect(PrimaryEffect);
BeaconWindow->GetBeaconEntity()->SetSecondaryEffect(SecondaryEffect);
// Valid effect check. Vanilla don't check this, but we do it :)
if (
(SecondaryEffect == cEntityEffect::effNoEffect) ||
(SecondaryEffect == cEntityEffect::effRegeneration) ||
(SecondaryEffect == BeaconWindow->GetBeaconEntity()->GetPrimaryEffect())
)
{
BeaconWindow->GetBeaconEntity()->SetSecondaryEffect(SecondaryEffect);
}
else
{
BeaconWindow->GetBeaconEntity()->SetSecondaryEffect(cEntityEffect::effNoEffect);
}
m_Player->CloseWindow(true);
}