Fix overread in projectile behavior and address broken stuns (#898)

* Fix overread in projectile behavior

* Fix stuns

* Correctly read in bitStream
This commit is contained in:
David Markowitz 2022-12-19 12:52:00 -08:00 committed by GitHub
parent d69f733772
commit 2fdcf62ec6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 4 deletions

View File

@ -13,7 +13,7 @@ void AttackDelayBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bi
};
for (auto i = 0u; i < this->m_numIntervals; ++i) {
context->RegisterSyncBehavior(handle, this, branch);
context->RegisterSyncBehavior(handle, this, branch, m_ignoreInterrupts);
}
}

View File

@ -45,12 +45,13 @@ uint32_t BehaviorContext::GetUniqueSkillId() const {
}
void BehaviorContext::RegisterSyncBehavior(const uint32_t syncId, Behavior* behavior, const BehaviorBranchContext& branchContext) {
void BehaviorContext::RegisterSyncBehavior(const uint32_t syncId, Behavior* behavior, const BehaviorBranchContext& branchContext, bool ignoreInterrupts) {
auto entry = BehaviorSyncEntry();
entry.handle = syncId;
entry.behavior = behavior;
entry.branchContext = branchContext;
entry.ignoreInterrupts = ignoreInterrupts;
this->syncEntries.push_back(entry);
}

View File

@ -80,7 +80,7 @@ struct BehaviorContext
uint32_t GetUniqueSkillId() const;
void RegisterSyncBehavior(uint32_t syncId, Behavior* behavior, const BehaviorBranchContext& branchContext);
void RegisterSyncBehavior(uint32_t syncId, Behavior* behavior, const BehaviorBranchContext& branchContext, bool ignoreInterrupts = false);
void RegisterTimerBehavior(Behavior* behavior, const BehaviorBranchContext& branchContext, LWOOBJID second = LWOOBJID_EMPTY);

View File

@ -31,7 +31,7 @@ void ProjectileAttackBehavior::Handle(BehaviorContext* context, RakNet::BitStrea
return;
}
if (m_useMouseposit) {
if (m_ProjectileType == 1) {
NiPoint3 targetPosition = NiPoint3::ZERO;
if (!bitStream->Read(targetPosition)) {
Game::logger->Log("ProjectileAttackBehavior", "Unable to read targetPosition from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
@ -157,4 +157,6 @@ void ProjectileAttackBehavior::Load() {
this->m_trackRadius = GetFloat("track_radius");
this->m_useMouseposit = GetBoolean("use_mouseposit");
this->m_ProjectileType = GetInt("projectile_type");
}

View File

@ -23,6 +23,8 @@ public:
bool m_useMouseposit;
int32_t m_ProjectileType;
/*
* Inherited
*/