mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-15 16:27:14 +00:00
fix(skill): a start with a skill handle still in progress is dropped, as the client
LWOSkillComponent::msgStartSkill (0x00d45cb0) logs and ignores a StartSkill whose skill handle is still waiting on behavior syncs. The server ran it a second time: the hits, the imagination cost and the mission progress twice. Live captures hold 22 byte-identical StartSkill resends with the same handle a few packets apart. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "GeneralUtils.h"
|
||||
#include "tinyxml2.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
@@ -34,7 +35,18 @@ ProjectileSyncEntry::ProjectileSyncEntry() {
|
||||
|
||||
std::unordered_map<uint32_t, uint32_t> SkillComponent::m_skillBehaviorCache = {};
|
||||
|
||||
bool SkillComponent::IsSkillPending(const uint32_t skillUid) const {
|
||||
const auto [begin, end] = m_managedBehaviors.equal_range(skillUid);
|
||||
return std::any_of(begin, end, [](const auto& pair) { return pair.second && !pair.second->syncEntries.empty(); });
|
||||
}
|
||||
|
||||
bool SkillComponent::CastPlayerSkill(const uint32_t behaviorId, const uint32_t skillUid, RakNet::BitStream& bitStream, const LWOOBJID target, uint32_t skillID) {
|
||||
// A skill handle still waiting on syncs is taken: the client logs and drops a second start with it
|
||||
if (IsSkillPending(skillUid)) {
|
||||
LOG("StartSkill with existing skill handle %u for %llu", skillUid, m_Parent->GetObjectID());
|
||||
return false;
|
||||
}
|
||||
|
||||
auto* context = new BehaviorContext(this->m_Parent->GetObjectID());
|
||||
|
||||
context->caster = m_Parent->GetObjectID();
|
||||
|
||||
Reference in New Issue
Block a user