Fix baseEnemyApe stuns and fix IdleFlags serialization (#914)

* Fix baseEnemyApe stuns

* Correct serialization
This commit is contained in:
David Markowitz 2022-12-22 22:14:51 -08:00 committed by GitHub
parent 9ebb06ba24
commit 675cf1d2a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions

View File

@ -3924,14 +3924,16 @@ void GameMessages::SendDisplayChatBubble(LWOOBJID objectId, const std::u16string
}
void GameMessages::SendChangeIdleFlags(LWOOBJID objectId, eAnimationFlags FlagsOn, eAnimationFlags FlagsOff, const SystemAddress& sysAddr) {
void GameMessages::SendChangeIdleFlags(LWOOBJID objectId, eAnimationFlags flagsOn, eAnimationFlags flagsOff, const SystemAddress& sysAddr) {
CBITSTREAM;
CMSGHEADER;
bitStream.Write(objectId);
bitStream.Write(GAME_MSG::GAME_MSG_CHANGE_IDLE_FLAGS);
bitStream.Write(FlagsOff);
bitStream.Write(FlagsOn);
bitStream.Write<bool>(flagsOff != eAnimationFlags::IDLE_NONE);
if (flagsOff != eAnimationFlags::IDLE_NONE) bitStream.Write(flagsOff);
bitStream.Write<bool>(flagsOn != eAnimationFlags::IDLE_NONE);
if (flagsOn != eAnimationFlags::IDLE_NONE) bitStream.Write(flagsOn);
SEND_PACKET_BROADCAST;
}

View File

@ -31,9 +31,12 @@ void BaseEnemyApe::OnHit(Entity* self, Entity* attacker) {
if (destroyableComponent != nullptr && destroyableComponent->GetArmor() < 1 && !self->GetBoolean(u"knockedOut")) {
StunApe(self, true);
self->CancelTimer("spawnQBTime");
auto* skillComponent = self->GetComponent<SkillComponent>();
if (skillComponent) {
skillComponent->Reset();
}
GameMessages::SendPlayAnimation(self, u"disable", 1.7f);
GameMessages::SendChangeIdleFlags(self->GetObjectID(), eAnimationFlags::IDLE_NONE, eAnimationFlags::IDLE_COMBAT, UNASSIGNED_SYSTEM_ADDRESS);
const auto reviveTime = self->GetVar<float_t>(u"reviveTime") != 0.0f
? self->GetVar<float_t>(u"reviveTime") : 12.0f;
self->AddTimer("reviveTime", reviveTime);
@ -50,6 +53,7 @@ void BaseEnemyApe::OnTimerDone(Entity* self, std::string timerName) {
destroyableComponent->SetArmor(destroyableComponent->GetMaxArmor() / timesStunned);
}
EntityManager::Instance()->SerializeEntity(self);
GameMessages::SendChangeIdleFlags(self->GetObjectID(), eAnimationFlags::IDLE_COMBAT, eAnimationFlags::IDLE_NONE, UNASSIGNED_SYSTEM_ADDRESS);
self->SetVar<uint32_t>(u"timesStunned", timesStunned + 1);
StunApe(self, false);