Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Another WIP

Pipe stealth and aura updates through create object

Add some serversides

WIP

Make first prototype work

WIP
  • Loading branch information
killerwife committed Feb 9, 2025
1 parent 15ba646 commit 91c1c43
Show file tree
Hide file tree
Showing 34 changed files with 593 additions and 369 deletions.
10 changes: 10 additions & 0 deletions sql/base/dbc/cmangos_fixes/Spell.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2475,6 +2475,11 @@ UPDATE spell_template SET AttributesEx=AttributesEx|0x00000400 WHERE Id IN(17466
INSERT INTO spell_template(Id, Category, Dispel, Mechanic, Attributes, AttributesEx, AttributesEx2, AttributesEx3, AttributesEx4, AttributesEx5, AttributesEx6, Stances, StancesNot, Targets, TargetCreatureType, RequiresSpellFocus, FacingCasterFlags, CasterAuraState, TargetAuraState, CasterAuraStateNot, TargetAuraStateNot, CastingTimeIndex, RecoveryTime, CategoryRecoveryTime, InterruptFlags, AuraInterruptFlags, ChannelInterruptFlags, ProcFlags, ProcChance, ProcCharges, MaxLevel, BaseLevel, SpellLevel, DurationIndex, PowerType, ManaCost, ManaCostPerlevel, ManaPerSecond, ManaPerSecondPerLevel, RangeIndex, Speed, ModalNextSpell, StackAmount, Totem1, Totem2, Reagent1, Reagent2, Reagent3, Reagent4, Reagent5, Reagent6, Reagent7, Reagent8, ReagentCount1, ReagentCount2, ReagentCount3, ReagentCount4, ReagentCount5, ReagentCount6, ReagentCount7, ReagentCount8, EquippedItemClass, EquippedItemSubClassMask, EquippedItemInventoryTypeMask, Effect1, Effect2, Effect3, EffectDieSides1, EffectDieSides2, EffectDieSides3, EffectRealPointsPerLevel1, EffectRealPointsPerLevel2, EffectRealPointsPerLevel3, EffectBasePoints1, EffectBasePoints2, EffectBasePoints3, EffectMechanic1, EffectMechanic2, EffectMechanic3, EffectImplicitTargetA1, EffectImplicitTargetA2, EffectImplicitTargetA3, EffectImplicitTargetB1, EffectImplicitTargetB2, EffectImplicitTargetB3, EffectRadiusIndex1, EffectRadiusIndex2, EffectRadiusIndex3, EffectApplyAuraName1, EffectApplyAuraName2, EffectApplyAuraName3, EffectAmplitude1, EffectAmplitude2, EffectAmplitude3, EffectMultipleValue1, EffectMultipleValue2, EffectMultipleValue3, EffectChainTarget1, EffectChainTarget2, EffectChainTarget3, EffectItemType1, EffectItemType2, EffectItemType3, EffectMiscValue1, EffectMiscValue2, EffectMiscValue3, EffectMiscValueB1, EffectMiscValueB2, EffectMiscValueB3, EffectTriggerSpell1, EffectTriggerSpell2, EffectTriggerSpell3, EffectPointsPerComboPoint1, EffectPointsPerComboPoint2, EffectPointsPerComboPoint3, SpellVisual, SpellIconID, ActiveIconID, SpellPriority, SpellName, SpellName2, SpellName3, SpellName4, SpellName5, SpellName6, SpellName7, SpellName8, SpellName9, SpellName10, SpellName11, SpellName12, SpellName13, SpellName14, SpellName15, SpellName16, Rank1, Rank2, Rank3, Rank4, Rank5, Rank6, Rank7, Rank8, Rank9, Rank10, Rank11, Rank12, Rank13, Rank14, Rank15, Rank16, ManaCostPercentage, StartRecoveryCategory, StartRecoveryTime, MaxTargetLevel, SpellFamilyName, SpellFamilyFlags, MaxAffectedTargets, DmgClass, PreventionType, StanceBarOrder, DmgMultiplier1, DmgMultiplier2, DmgMultiplier3, MinFactionId, MinReputation, RequiredAuraVision, TotemCategory1, TotemCategory2, AreaId, SchoolMask, EffectBonusCoefficient1, EffectBonusCoefficient2, EffectBonusCoefficient3, EffectBonusCoefficientFromAP1, EffectBonusCoefficientFromAP2, EffectBonusCoefficientFromAP3, IsServerSide, AttributesServerside) VALUES
('25175', '65', '0', '0', '262416', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0', '101', '0', '0', '14', '14', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '-1', '0', '0', '19', '0', '0', '1', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '108', '0', '0', 'Triple Attack', '', '', '', '', '', '', '', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '0', '0', '0', '0', '0', '0', '0', '2', '2', '0', '1', '1', '1', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0', '0', '0');

-- missing proc parent spell
INSERT INTO `spell_template` (`Id`, `SchoolMask`, `Category`, `Dispel`, `Mechanic`, `Attributes`, `AttributesEx`, `AttributesEx2`, `AttributesEx3`, `AttributesEx4`, `AttributesEx5`, `Stances`, `StancesNot`, `Targets`, `TargetCreatureType`, `RequiresSpellFocus`, `CasterAuraState`, `TargetAuraState`, `CasterAuraStateNot`, `TargetAuraStateNot`, `CastingTimeIndex`, `RecoveryTime`, `CategoryRecoveryTime`, `InterruptFlags`, `AuraInterruptFlags`, `ChannelInterruptFlags`, `procFlags`, `procChance`, `procCharges`, `maxLevel`, `baseLevel`, `spellLevel`, `DurationIndex`, `powerType`, `manaCost`, `manaCostPerLevel`, `manaPerSecond`, `manaPerSecondPerLevel`, `rangeIndex`, `speed`, `StackAmount`, `Totem1`, `Totem2`, `Reagent1`, `Reagent2`, `Reagent3`, `Reagent4`, `Reagent5`, `Reagent6`, `Reagent7`, `Reagent8`, `ReagentCount1`, `ReagentCount2`, `ReagentCount3`, `ReagentCount4`, `ReagentCount5`, `ReagentCount6`, `ReagentCount7`, `ReagentCount8`, `EquippedItemClass`, `EquippedItemSubClassMask`, `EquippedItemInventoryTypeMask`, `Effect1`, `Effect2`, `Effect3`, `EffectDieSides1`, `EffectDieSides2`, `EffectDieSides3`, `EffectRealPointsPerLevel1`, `EffectRealPointsPerLevel2`, `EffectRealPointsPerLevel3`, `EffectBasePoints1`, `EffectBasePoints2`, `EffectBasePoints3`, `EffectMechanic1`, `EffectMechanic2`, `EffectMechanic3`, `EffectImplicitTargetA1`, `EffectImplicitTargetA2`, `EffectImplicitTargetA3`, `EffectImplicitTargetB1`, `EffectImplicitTargetB2`, `EffectImplicitTargetB3`, `EffectRadiusIndex1`, `EffectRadiusIndex2`, `EffectRadiusIndex3`, `EffectApplyAuraName1`, `EffectApplyAuraName2`, `EffectApplyAuraName3`, `EffectAmplitude1`, `EffectAmplitude2`, `EffectAmplitude3`, `EffectMultipleValue1`, `EffectMultipleValue2`, `EffectMultipleValue3`, `EffectChainTarget1`, `EffectChainTarget2`, `EffectChainTarget3`, `EffectItemType1`, `EffectItemType2`, `EffectItemType3`, `EffectMiscValue1`, `EffectMiscValue2`, `EffectMiscValue3`, `EffectMiscValueB1`, `EffectMiscValueB2`, `EffectMiscValueB3`, `EffectTriggerSpell1`, `EffectTriggerSpell2`, `EffectTriggerSpell3`, `EffectPointsPerComboPoint1`, `EffectPointsPerComboPoint2`, `EffectPointsPerComboPoint3`, `SpellVisual`, `SpellIconID`, `activeIconID`, `spellPriority`, `SpellName`, `SpellName2`, `SpellName3`, `SpellName4`, `SpellName5`, `SpellName6`, `SpellName7`, `SpellName8`, `ManaCostPercentage`, `StartRecoveryCategory`, `StartRecoveryTime`, `MaxTargetLevel`, `SpellFamilyName`, `SpellFamilyFlags`, `MaxAffectedTargets`, `DmgClass`, `PreventionType`, `DmgMultiplier1`, `DmgMultiplier2`, `DmgMultiplier3`, `TotemCategory1`, `TotemCategory2`, `AreaId`) VALUES
('4160','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','1','0','0','0','0','0','0','101','0','0','25','25','0','0','0','0','0','0','2','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','-1','-1','0','58','0','0','1','0','0','0','0','0','-1','0','0','0','0','0','6','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','387','146','0','0','Quick Snap','','','','','','','','0','0','0','0','0','0','0','0','0','1','1','1','0','0','0'),
('4161','1','0','0','0','448','0','0','0','0','0','0','0','0','0','0','0','0','0','0','1','0','0','0','0','0','40','20','0','0','0','25','21','0','0','0','0','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','-1','-1','0','6','0','0','0','0','0','0','0','0','0','0','0','0','0','0','1','0','0','0','0','0','0','0','0','42','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','4160','0','0','0','0','0','0','146','0','0','Quick Snap','','','','','','','','0','0','0','0','0','0','0','0','0','1','1','1','0','0','0');

-- ============================================================
-- TBC section
-- ============================================================
Expand Down Expand Up @@ -3640,6 +3645,11 @@ UPDATE spell_template SET MaxAffectedTargets = 12 WHERE id = 58912;

UPDATE spell_template SET AttributesServerSide = AttributesServerSide|0x00000004 WHERE Id IN (58548); -- Ethereal

-- spells used in vanilla, present in tbc but culled in wotlk
INSERT INTO `spell_template` (`Id`, `SchoolMask`, `Category`, `Dispel`, `Mechanic`, `Attributes`, `AttributesEx`, `AttributesEx2`, `AttributesEx3`, `AttributesEx4`, `AttributesEx5`, `Stances`, `StancesNot`, `Targets`, `TargetCreatureType`, `RequiresSpellFocus`, `CasterAuraState`, `TargetAuraState`, `CasterAuraStateNot`, `TargetAuraStateNot`, `CastingTimeIndex`, `RecoveryTime`, `CategoryRecoveryTime`, `InterruptFlags`, `AuraInterruptFlags`, `ChannelInterruptFlags`, `procFlags`, `procChance`, `procCharges`, `maxLevel`, `baseLevel`, `spellLevel`, `DurationIndex`, `powerType`, `manaCost`, `manaCostPerLevel`, `manaPerSecond`, `manaPerSecondPerLevel`, `rangeIndex`, `speed`, `StackAmount`, `Totem1`, `Totem2`, `Reagent1`, `Reagent2`, `Reagent3`, `Reagent4`, `Reagent5`, `Reagent6`, `Reagent7`, `Reagent8`, `ReagentCount1`, `ReagentCount2`, `ReagentCount3`, `ReagentCount4`, `ReagentCount5`, `ReagentCount6`, `ReagentCount7`, `ReagentCount8`, `EquippedItemClass`, `EquippedItemSubClassMask`, `EquippedItemInventoryTypeMask`, `Effect1`, `Effect2`, `Effect3`, `EffectDieSides1`, `EffectDieSides2`, `EffectDieSides3`, `EffectRealPointsPerLevel1`, `EffectRealPointsPerLevel2`, `EffectRealPointsPerLevel3`, `EffectBasePoints1`, `EffectBasePoints2`, `EffectBasePoints3`, `EffectMechanic1`, `EffectMechanic2`, `EffectMechanic3`, `EffectImplicitTargetA1`, `EffectImplicitTargetA2`, `EffectImplicitTargetA3`, `EffectImplicitTargetB1`, `EffectImplicitTargetB2`, `EffectImplicitTargetB3`, `EffectRadiusIndex1`, `EffectRadiusIndex2`, `EffectRadiusIndex3`, `EffectApplyAuraName1`, `EffectApplyAuraName2`, `EffectApplyAuraName3`, `EffectAmplitude1`, `EffectAmplitude2`, `EffectAmplitude3`, `EffectMultipleValue1`, `EffectMultipleValue2`, `EffectMultipleValue3`, `EffectChainTarget1`, `EffectChainTarget2`, `EffectChainTarget3`, `EffectItemType1`, `EffectItemType2`, `EffectItemType3`, `EffectMiscValue1`, `EffectMiscValue2`, `EffectMiscValue3`, `EffectMiscValueB1`, `EffectMiscValueB2`, `EffectMiscValueB3`, `EffectTriggerSpell1`, `EffectTriggerSpell2`, `EffectTriggerSpell3`, `EffectPointsPerComboPoint1`, `EffectPointsPerComboPoint2`, `EffectPointsPerComboPoint3`, `SpellVisual`, `SpellIconID`, `activeIconID`, `spellPriority`, `SpellName`, `SpellName2`, `SpellName3`, `SpellName4`, `SpellName5`, `SpellName6`, `SpellName7`, `SpellName8`, `ManaCostPercentage`, `StartRecoveryCategory`, `StartRecoveryTime`, `MaxTargetLevel`, `SpellFamilyName`, `SpellFamilyFlags`, `MaxAffectedTargets`, `DmgClass`, `PreventionType`, `DmgMultiplier1`, `DmgMultiplier2`, `DmgMultiplier3`, `TotemCategory1`, `TotemCategory2`, `AreaId`) VALUES
('12002','8','0','0','0','464','0','0','0','0','0','0','0','0','0','0','0','0','0','0','1','0','0','0','0','0','40','5','0','0','20','20','21','0','0','0','0','0','4','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','-1','-1','0','6','0','0','1','0','0','0','0','0','-1','0','0','0','0','0','1','0','0','0','0','0','0','0','0','42','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','12001','0','0','0','0','0','0','160','0','0','Plague Cloud','','','','','','','','0','0','0','0','0','0','0','0','0','1','1','1','0','0','0'),
('17507','1','0','0','0','448','268435456','0','0','0','0','0','0','0','0','0','0','0','0','0','1','0','0','0','0','0','0','101','0','0','0','0','21','0','0','0','0','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','0','6','0','0','0','0','0','0','0','0','0','0','0','0','0','0','1','0','0','0','0','0','0','0','0','26','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','20','0','0','Passive Root','','','','','','','','0','0','0','0','0','0','0','0','0','1','0','0','0','0','0');

-- ============================================================
-- Missing WotLK Achievement Spells
-- ============================================================
Expand Down
2 changes: 0 additions & 2 deletions src/game/AI/ScriptDevAI/scripts/kalimdor/ungoro_crater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -569,12 +569,10 @@ struct npc_simone_seductressAI : public ScriptedAI
{
pPrecious->SetVisibility(VISIBILITY_OFF);
pPrecious->ForcedDespawn();
pPrecious->RemoveFromWorld();
}

m_creature->SetVisibility(VISIBILITY_OFF);
m_creature->ForcedDespawn();
m_creature->RemoveFromWorld();
}

void SpellHit(Unit* /*pCaster*/, const SpellEntry* pSpell) override
Expand Down
2 changes: 1 addition & 1 deletion src/game/Entities/Bag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ void Bag::StoreItem(uint8 slot, Item* pItem)
}
}

void Bag::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) const
void Bag::BuildCreateUpdateBlockForPlayer(UpdateData& data, Player* target) const
{
Item::BuildCreateUpdateBlockForPlayer(data, target);

Expand Down
2 changes: 1 addition & 1 deletion src/game/Entities/Bag.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class Bag : public Item
// overwrite virtual Item::DeleteFromDB
void DeleteFromDB() override;

void BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) const override;
void BuildCreateUpdateBlockForPlayer(UpdateData& data, Player* target) const override;

protected:

Expand Down
20 changes: 14 additions & 6 deletions src/game/Entities/Camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void Camera::UpdateForCurrentViewPoint()
if (GridType* grid = m_source->GetViewPoint().m_grid)
grid->AddWorldObject(this);

UpdateVisibilityForOwner();
m_source->GetMap()->AddUpdateCreateObject(m_source);
}

void Camera::SetView(WorldObject* obj, bool update_far_sight_field /*= true*/)
Expand Down Expand Up @@ -100,13 +100,14 @@ void Camera::ResetView(bool update_far_sight_field /*= true*/)
SetView(&m_owner, update_far_sight_field);
}

void Camera::Event_AddedToWorld(UpdateData& data)
void Camera::Event_AddedToWorld(UpdateData* data)
{
GridType* grid = m_source->GetViewPoint().m_grid;
MANGOS_ASSERT(grid);
grid->AddWorldObject(this);

UpdateVisibilityForOwner(true, data);
if (data)
UpdateVisibilityForOwner(true, *data);
}

void Camera::Event_RemovedFromWorld()
Expand Down Expand Up @@ -143,10 +144,17 @@ template void Camera::UpdateVisibilityOf(Corpse*, UpdateData&, WorldObjectSet&);
template void Camera::UpdateVisibilityOf(GameObject*, UpdateData&, WorldObjectSet&);
template void Camera::UpdateVisibilityOf(DynamicObject*, UpdateData&, WorldObjectSet&);

void Camera::UpdateVisibilityForOwner()
void Camera::UpdateVisibilityForOwner(UpdateDataMapType& update_players)
{
UpdateData data;
UpdateVisibilityForOwner(false, data);
UpdateDataMapType::iterator iter = update_players.find(GetOwner());

if (iter == update_players.end())
{
std::pair<UpdateDataMapType::iterator, bool> p = update_players.insert(UpdateDataMapType::value_type(GetOwner(), UpdateData()));
MANGOS_ASSERT(p.second);
iter = p.first;
}
UpdateVisibilityForOwner(true, iter->second);
}

void Camera::UpdateVisibilityForOwner(bool addToWorld, UpdateData& data)
Expand Down
10 changes: 5 additions & 5 deletions src/game/Entities/Camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ class Camera
void ReceivePacket(WorldPacket const& data) const;

// updates visibility of worldobjects around viewpoint for camera's owner
void UpdateVisibilityForOwner();
void UpdateVisibilityForOwner(UpdateDataMapType& update_players);
void UpdateVisibilityForOwner(bool addToWorld, UpdateData& data);

bool IsSendInProgress() const { return m_sendInProgress; }

private:
// called when viewpoint changes visibility state
void Event_AddedToWorld(UpdateData& data);
void Event_AddedToWorld(UpdateData* data);
void Event_RemovedFromWorld();
void Event_Moved();
void Event_ViewPointVisibilityChanged();
Expand Down Expand Up @@ -113,7 +113,7 @@ class ViewPoint
bool hasViewers() const { return !m_cameras.empty(); }

// these events are called when viewpoint changes visibility state
void Event_AddedToWorld(GridType* grid, UpdateData& data)
void Event_AddedToWorld(GridType* grid, UpdateData* data)
{
m_grid = grid;
CameraCall([&](Camera* c) { c->Event_AddedToWorld(data); });
Expand All @@ -136,9 +136,9 @@ class ViewPoint
CameraCall([&](Camera* c) { c->Event_ViewPointVisibilityChanged(); });
}

void Call_UpdateVisibilityForOwner()
void Call_UpdateVisibilityForOwner(UpdateDataMapType& update_players)
{
CameraCall([&](Camera* c) { c->UpdateVisibilityForOwner(); });
CameraCall([&](Camera* c) { c->UpdateVisibilityForOwner(update_players); });
}
};

Expand Down
16 changes: 7 additions & 9 deletions src/game/Entities/Creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ Creature::Creature(CreatureSubtype subtype) : Unit(),

Creature::~Creature()
{
if (m_uint32Values && (GetEntry() == 34925 || GetEntry() == 31243))
printf("");
if (GetVisibilityData().IsLargeVisibility())
printf("");
CleanupsBeforeDelete();
}

Expand Down Expand Up @@ -272,7 +276,6 @@ void Creature::RemoveCorpse(bool inPlace)

m_corpseExpirationTime = TimePoint();
SetDeathState(DEAD);
UpdateObjectVisibility();

delete m_loot;
m_loot = nullptr;
Expand Down Expand Up @@ -304,14 +307,9 @@ void Creature::RemoveCorpse(bool inPlace)
GetRespawnCoord(x, y, z, &o);
GetMap()->CreatureRelocation(this, x, y, z, o);

// forced recreate creature object at clients
UnitVisibility currentVis = GetVisibility();
SetVisibility(VISIBILITY_REMOVE_CORPSE);
UpdateObjectVisibility();
SetVisibility(currentVis); // restore visibility state
UpdateObjectVisibility();

if (IsUsingNewSpawningSystem())
if (!IsUsingNewSpawningSystem()) // schedule out of range
GetMap()->AddUpdateRemoveObject(GetClientGuidsIAmAt(), GetObjectGuid());
else
AddObjectToRemoveList();
}

Expand Down
4 changes: 3 additions & 1 deletion src/game/Entities/DynamicObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void DynamicObject::RemoveFromWorld()
GetMap()->GetObjectsStore().erase<DynamicObject>(GetObjectGuid(), (DynamicObject*)nullptr);
}

Object::RemoveFromWorld();
WorldObject::RemoveFromWorld();
}

bool DynamicObject::Create(uint32 guidlow, Unit* caster, uint32 spellId, SpellEffectIndex effIndex, float x, float y, float z, int32 duration, float radius, DynamicObjectType type, SpellTarget target, int32 damage, int32 basePoints)
Expand Down Expand Up @@ -155,6 +155,8 @@ void DynamicObject::Update(const uint32 /*diff*/)
void DynamicObject::Delete()
{
SendObjectDeSpawnAnim(GetObjectGuid());
if (!GetMap()->IsUpdateObjectTick())
DestroyOnClientsIAmAt();
AddObjectToRemoveList();
}

Expand Down
3 changes: 3 additions & 0 deletions src/game/Entities/EntitiesMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class Player;
class Pet;
class DynamicObject;
class Corpse;
class UpdateData;
struct CreatureData;
struct GameObjectData;

Expand All @@ -54,4 +55,6 @@ typedef std::map<uint32, GameObject*> GameObjectsMap;
typedef std::map<uint32, DynamicObject*> DynamicObjectsMap;
typedef std::map<uint32, Corpse*> PlayerCorpsesMap;

typedef std::unordered_map<Player*, UpdateData> UpdateDataMapType;

#endif
9 changes: 4 additions & 5 deletions src/game/Entities/GameObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ void GameObject::Update(const uint32 diff)

// can be not in world at pool despawn
if (IsInWorld())
UpdateObjectVisibility();
GetMap()->AddUpdateObject(this);

break;
}
Expand Down Expand Up @@ -1131,10 +1131,6 @@ bool GameObject::isVisibleForInState(Player const* u, WorldObject const* viewPoi
if (!GetGOInfo()->displayId)
return false;

// Transport always visible at this step implementation
if (IsMoTransport() && IsInMap(u))
return true;

// quick check visibility false cases for non-GM-mode
if (!u->IsGameMaster())
{
Expand Down Expand Up @@ -1210,6 +1206,9 @@ bool GameObject::isVisibleForInState(Player const* u, WorldObject const* viewPoi
}
}

if (GetVisibilityData().IsInfiniteVisibility())
return true;

// check distance
return IsWithinDistInMap(viewPoint, GetVisibilityData().GetVisibilityDistance(), false);
}
Expand Down
6 changes: 6 additions & 0 deletions src/game/Entities/Item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1207,6 +1207,12 @@ void Item::BuildUpdateData(UpdateDataMapType& update_players)
ClearUpdateMask(false);
}

void Item::UpdateVisibility(UpdateDataMapType& /*update_players*/)
{
if (Player* pl = GetOwner())
pl->GetMap()->AddCreateAtClientObject(pl, this);
}

uint32 Item::GetTotalAP() const
{
int32 totalAP = 0;
Expand Down
Loading

0 comments on commit 91c1c43

Please sign in to comment.