diff --git a/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp b/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp index 63e43d6a772a43..5586875a4fdbfc 100644 --- a/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp +++ b/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp @@ -87,7 +87,8 @@ bool AreaTrigger::Create(uint32 spellMiscId, Unit* caster, Unit* target, SpellIn } _areaTriggerTemplate = _areaTriggerMiscTemplate->Template; - WorldObject::_Create(caster->GetMap()->GenerateLowGuid(), HighGuid::DynamicObject, caster->GetPhaseMask()); + auto templateId = GetTemplate() ? GetTemplate()->Id : 0; + Object::_Create(ObjectGuid::Create(templateId, caster->GetMap()->GenerateLowGuid())); UpdatePositionData(); diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 97f90bdddd80f3..68a717abb22763 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -140,6 +140,12 @@ void Object::_Create(ObjectGuid::LowType guidlow, uint32 entry, HighGuid guidhig m_PackGUID.Set(guid); } +void Object::_Create(ObjectGuid const& guid) +{ + m_objectUpdated = false; + SetGuidValue(OBJECT_FIELD_GUID, guid); +} + std::string Object::_ConcatFields(uint16 startIndex, uint16 size) const { std::ostringstream ss; diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index 5ee201e8e13ebe..2ce92bdb802ff3 100644 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -217,6 +217,8 @@ class Object void _InitValues(); void _Create(ObjectGuid::LowType guidlow, uint32 entry, HighGuid guidhigh); + void _Create(ObjectGuid const& guid); + [[nodiscard]] std::string _ConcatFields(uint16 startIndex, uint16 size) const; bool _LoadIntoDataField(std::string const& data, uint32 startOffset, uint32 count); diff --git a/src/server/game/Entities/Object/ObjectGuid.h b/src/server/game/Entities/Object/ObjectGuid.h index 9af840908b1fe0..6561777d6bcce3 100644 --- a/src/server/game/Entities/Object/ObjectGuid.h +++ b/src/server/game/Entities/Object/ObjectGuid.h @@ -72,7 +72,6 @@ enum class HighGuid Mo_Transport = 0x1FC0, // blizz 1FC0 (for GAMEOBJECT_TYPE_MO_TRANSPORT) Instance = 0x1F40, // blizz 1F40 Group = 0x1F50, - AreaTrigger = 0xfff0, }; template @@ -108,7 +107,6 @@ GUID_TRAIT_MAP_SPECIFIC(HighGuid::Pet) GUID_TRAIT_MAP_SPECIFIC(HighGuid::GameObject) GUID_TRAIT_MAP_SPECIFIC(HighGuid::DynamicObject) GUID_TRAIT_MAP_SPECIFIC(HighGuid::Corpse) -GUID_TRAIT_MAP_SPECIFIC(HighGuid::AreaTrigger) class ObjectGuid; class PackedGuid; diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index e4a95867ae7ccb..54716355246fa6 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -16762,12 +16762,17 @@ void Player::UpdateOperations() for (auto spell : toDelete) { auto info = sSpellMgr->GetSpellInfo(spell); - auto charged = sObjectMgr->TryGetChargeEntry(info->SpellFamilyFlags); - auto chargeCount = GetItemCount(charged->chargeItem); - auto maxCharges = charged->baseCharges + CalculateSpellMaxCharges(info->SpellFamilyFlags); + if (auto charged = sObjectMgr->TryGetChargeEntry(info->SpellFamilyFlags)) { + auto chargeCount = GetItemCount(charged->chargeItem); + auto maxCharges = charged->baseCharges + CalculateSpellMaxCharges(info->SpellFamilyFlags); - if (chargeCount == maxCharges) + if (chargeCount == maxCharges) + timedDelayedOperations.erase(spell); + } + else { timedDelayedOperations.erase(spell); + } + } if (timedDelayedOperations.empty() && !emptyWarned)