Skip to content

Commit

Permalink
update spec set
Browse files Browse the repository at this point in the history
  • Loading branch information
hatersgit committed Nov 23, 2023
1 parent 609894d commit a66fd61
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/server/game/Entities/AreaTrigger/AreaTrigger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ bool AreaTrigger::Create(uint32 spellMiscId, Unit* caster, Unit* target, SpellIn
}

_areaTriggerTemplate = _areaTriggerMiscTemplate->Template;
WorldObject::_Create(caster->GetMap()->GenerateLowGuid<HighGuid::DynamicObject>(), HighGuid::DynamicObject, caster->GetPhaseMask());
auto templateId = GetTemplate() ? GetTemplate()->Id : 0;
Object::_Create(ObjectGuid::Create<HighGuid::DynamicObject>(templateId, caster->GetMap()->GenerateLowGuid<HighGuid::DynamicObject>()));

UpdatePositionData();

Expand Down
6 changes: 6 additions & 0 deletions src/server/game/Entities/Object/Object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/server/game/Entities/Object/Object.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 0 additions & 2 deletions src/server/game/Entities/Object/ObjectGuid.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<HighGuid high>
Expand Down Expand Up @@ -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;
Expand Down
13 changes: 9 additions & 4 deletions src/server/game/Entities/Player/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit a66fd61

Please sign in to comment.