Imminuty updates (#925)

* WIP Immunities

* Immunity getters

* remove redundent variable
replace it use with it's equivalent

* remove unused lookups, fix typos

* fix tests

* added imunity test

* address feedback

* more immunity tests

* explicit this
This commit is contained in:
Aaron Kimbrell
2023-01-06 23:59:19 -06:00
committed by GitHub
parent 1ac898ba00
commit 80f8dd8003
25 changed files with 681 additions and 99 deletions

View File

@@ -2904,7 +2904,7 @@ void GameMessages::HandleCinematicUpdate(RakNet::BitStream* inStream, Entity* en
}
}
void GameMessages::SendSetStunned(LWOOBJID objectId, eStunState stateChangeType, const SystemAddress& sysAddr,
void GameMessages::SendSetStunned(LWOOBJID objectId, eStateChangeType stateChangeType, const SystemAddress& sysAddr,
LWOOBJID originator, bool bCantAttack, bool bCantEquip,
bool bCantInteract, bool bCantJump, bool bCantMove, bool bCantTurn,
bool bCantUseItem, bool bDontTerminateInteract, bool bIgnoreImmunity,
@@ -2952,6 +2952,69 @@ void GameMessages::SendSetStunned(LWOOBJID objectId, eStunState stateChangeType,
SEND_PACKET;
}
void GameMessages::SendSetStunImmunity(LWOOBJID target, eStateChangeType state, const SystemAddress& sysAddr,
LWOOBJID originator,
bool bImmuneToStunAttack,
bool bImmuneToStunEquip,
bool bImmuneToStunInteract,
bool bImmuneToStunJump,
bool bImmuneToStunMove,
bool bImmuneToStunTurn,
bool bImmuneToStunUseItem) {
CBITSTREAM;
CMSGHEADER;
bitStream.Write(target);
bitStream.Write(GAME_MSG::GAME_MSG_SET_STUN_IMMUNITY);
bitStream.Write(originator != LWOOBJID_EMPTY);
if (originator != LWOOBJID_EMPTY) bitStream.Write(originator);
bitStream.Write(state);
bitStream.Write(bImmuneToStunAttack);
bitStream.Write(bImmuneToStunEquip);
bitStream.Write(bImmuneToStunInteract);
bitStream.Write(bImmuneToStunJump);
bitStream.Write(bImmuneToStunMove);
bitStream.Write(bImmuneToStunTurn);
bitStream.Write(bImmuneToStunUseItem);
if (sysAddr == UNASSIGNED_SYSTEM_ADDRESS) SEND_PACKET_BROADCAST;
SEND_PACKET;
}
void GameMessages::SendSetStatusImmunity(LWOOBJID objectId, eStateChangeType state, const SystemAddress& sysAddr,
bool bImmuneToBasicAttack,
bool bImmuneToDamageOverTime,
bool bImmuneToKnockback,
bool bImmuneToInterrupt,
bool bImmuneToSpeed,
bool bImmuneToImaginationGain,
bool bImmuneToImaginationLoss,
bool bImmuneToQuickbuildInterrupt,
bool bImmuneToPullToPoint) {
CBITSTREAM;
CMSGHEADER;
bitStream.Write(objectId);
bitStream.Write(GAME_MSG::GAME_MSG_SET_STATUS_IMMUNITY);
bitStream.Write(state);
bitStream.Write(bImmuneToBasicAttack);
bitStream.Write(bImmuneToDamageOverTime);
bitStream.Write(bImmuneToKnockback);
bitStream.Write(bImmuneToInterrupt);
bitStream.Write(bImmuneToSpeed);
bitStream.Write(bImmuneToImaginationGain);
bitStream.Write(bImmuneToImaginationLoss);
bitStream.Write(bImmuneToQuickbuildInterrupt);
bitStream.Write(bImmuneToPullToPoint);
if (sysAddr == UNASSIGNED_SYSTEM_ADDRESS) SEND_PACKET_BROADCAST;
SEND_PACKET;
}
void GameMessages::SendOrientToAngle(LWOOBJID objectId, bool bRelativeToCurrent, float fAngle, const SystemAddress& sysAddr) {
CBITSTREAM;
@@ -3991,7 +4054,7 @@ void GameMessages::HandleDismountComplete(RakNet::BitStream* inStream, Entity* e
EntityManager::Instance()->SerializeEntity(entity);
// We aren't mounted so remove the stun
GameMessages::SendSetStunned(entity->GetObjectID(), eStunState::POP, UNASSIGNED_SYSTEM_ADDRESS, LWOOBJID_EMPTY, true, false, true, false, false, false, false, true, true, true, true, true, true, true, true, true);
GameMessages::SendSetStunned(entity->GetObjectID(), eStateChangeType::POP, UNASSIGNED_SYSTEM_ADDRESS, LWOOBJID_EMPTY, true, false, true, false, false, false, false, true, true, true, true, true, true, true, true, true);
}
}
}

View File

@@ -268,7 +268,7 @@ namespace GameMessages {
float leadOut = -1.0f, bool leavePlayerLocked = false);
void HandleCinematicUpdate(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr);
void SendSetStunned(LWOOBJID objectId, eStunState stateChangeType, const SystemAddress& sysAddr,
void SendSetStunned(LWOOBJID objectId, eStateChangeType stateChangeType, const SystemAddress& sysAddr,
LWOOBJID originator = LWOOBJID_EMPTY, bool bCantAttack = false, bool bCantEquip = false,
bool bCantInteract = false, bool bCantJump = false, bool bCantMove = false, bool bCantTurn = false,
bool bCantUseItem = false, bool bDontTerminateInteract = false, bool bIgnoreImmunity = true,
@@ -277,6 +277,35 @@ namespace GameMessages {
bool bCantMoveOutChangeWasApplied = false, bool bCantTurnOutChangeWasApplied = false,
bool bCantUseItemOutChangeWasApplied = false);
void SendSetStunImmunity(
LWOOBJID target,
eStateChangeType state,
const SystemAddress& sysAddr,
LWOOBJID originator = LWOOBJID_EMPTY,
bool bImmuneToStunAttack = false,
bool bImmuneToStunEquip = false,
bool bImmuneToStunInteract = false,
bool bImmuneToStunJump = false,
bool bImmuneToStunMove = false,
bool bImmuneToStunTurn = false,
bool bImmuneToStunUseItem = false
);
void SendSetStatusImmunity(
LWOOBJID objectId,
eStateChangeType state,
const SystemAddress& sysAddr,
bool bImmuneToBasicAttack = false,
bool bImmuneToDamageOverTime = false,
bool bImmuneToKnockback = false,
bool bImmuneToInterrupt = false,
bool bImmuneToSpeed = false,
bool bImmuneToImaginationGain = false,
bool bImmuneToImaginationLoss = false,
bool bImmuneToQuickbuildInterrupt = false,
bool bImmuneToPullToPoint = false
);
void SendOrientToAngle(LWOOBJID objectId, bool bRelativeToCurrent, float fAngle, const SystemAddress& sysAddr);
void SendAddRunSpeedModifier(LWOOBJID objectId, LWOOBJID caster, uint32_t modifier, const SystemAddress& sysAddr);